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.
Make command options:
Options, and their default values.
--path =
App/Http/Livewire/Forms
Output path.--modelspath =
Models
. You can set this toApp
orAny\\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 forupdate
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?