Video Version of the Lesson
[Only for premium members]
[Only for premium members]
[Only for premium members]
In this 3-in-1 lesson, let's talk about the most common operations we can do with Filament columns/fields:
I decided to group those into one lesson because they are so easily accomplished in Filament that the lesson will be pretty short, anyway.
If you want to add behavior to form fields, you can chain multiple methods to the XxxxxColumn::make()
method.
One of the most widely used ones would be ->required()
for the validation.
return $form ->schema([ Forms\Components\TextInput::make('name')->required(), Forms\Components\TextInput::make('price')->required(), ]);
Just by adding this, we have this behavior in the create/edit forms: validation error and asterisk sign near the label.
And there are more Filament methods for validation that you can chain together.
Forms\Components\TextInput::make('name') ->required() ->unique(),
Notice: I start putting those methods on separate lines for better readability.
Some Filament validation methods have extra...