Standard form

Requires an Eloquent Model

Using the Artisan make command:

This command will create a new form component in app/Http/Livewire/Forms folder.

php artisan make:tall-form CreateUser --model=User

Make command options:

php artisan make:tall-form {name} {--model=Model} {--path=Http/Livewire/Forms} {--modelspath=Models} {--action=create} {--overwrite=false} {--skipexisting=false}

Options, and their default values.

  • --path = App/Http/Livewire/Forms Output path.

  • --modelspath = Models. You can set this to App or Any\\Path\\With\\Backslash /Or/Slash.

  • --action = create. Options: create, edit, modal, no-buttons. Which stub to use.

  • --overwrite = false. WARNING: Overwrites ALL existing forms, without prompts.

  • --skipexisting = false. If false && overwrite=false, you'll be prompted to confirm overwriting EACH existing file.

Stubs

  • There are two stubs. One for create forms and one for update forms.

  • Defined by the --action parameter in the make command.

  • The --action=create stub is suitable for forms with optional route model binding.

Examples

Create a component in the Controllers directory

Use a model in the App directory, example: use App\User;

Example

Protip: you can add the FillsColumns trait to your model for automatic $fillables from database column names.

Last updated

Was this helpful?