1SIMPLE1 inc banner
1SIMPLE1 inc logo

1SIMPLE1 inc

Instructor

Featured Course

Adding a form to a Livewire component 03:00
play
Management Agile
Adding a form to a Livewire component

Setting a form modelGiving the $form access to a model is useful for a few reasons:It allows fields within that form to load information from that model. For example, select fields can load their options from the database automatically.The form can load and save the model's relationship data automatically. For example, you have an Edit Post form, with a Repeater which manages comments associated with that post. Filament will automatically load the comments for that post when you call $this->form->fill([...]), and save them back to the relationship when you call $this->form->getState().Validation rules like exists() and unique() can automatically retrieve the database table name from the model.It is advised to always pass the model to the form when there is one. As explained, it unlocks many new powers of the Filament Form Builder.To pass the model to the form, use the $form->model() method:

4 months ago 128 views

About

Created: 10 Dec 2024
Followers
0
Following
1
Courses
1

Related Channels

See all