Skip to content

[Feature] Modal Forms (Inline Create/Edit) #5

Description

@devalade

Description

Option to generate Create/Edit forms in modals instead of separate pages.

Proposed Syntax

php artisan crudify:generate Product --fields="name:string" --modal-forms

Behavior

  • Index page has a "Create" button that opens a modal
  • Each row has an "Edit" button that opens a modal with pre-filled data
  • No separate /create or /{id}/edit routes needed
  • Uses Livewire's native modal support or Alpine.js

Benefits

  • Faster UX - no page reloads
  • Context preserved - filters/search stay intact
  • Mobile-friendly

Example Component

class Index extends Component
{
    public bool $showModal = false;
    public ?Product $editingProduct = null;
    
    public function create(): void
    {
        $this->editingProduct = null;
        $this->showModal = true;
    }
    
    public function edit(Product $product): void
    {
        $this->editingProduct = $product;
        $this->showModal = true;
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions