Standard form
Requires an Eloquent Model
Using the Artisan make command:
make command:This command will create a new form component in app/Http/Livewire/Forms folder.
php artisan make:tall-form CreateUser --model=UserMake 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/FormsOutput path.--modelspath =
Models. You can set this toApporAny\\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
createforms and one forupdateforms.Defined by the
--actionparameter in the make command.The
--action=createstub 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?