Different form for create and edit in laravel filament
I am using laravel filament and i want to develop different forms in a resoruce for create and edit. I mean that i have 5 fields when i create and i want 3 fields only while editing it not other fields. how to do it?
@jatanbhimani You can use visible() method in your input.
Imagine that, you want to show the password field only during creating the user, but NOT during editing the user's data. In that case, you can simply use the visible in the form() method in your UserResource.
For example:
use Filament\Resources\Pages\CreateRecord;
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('first_name')
->required(),
TextInput::make('last_name')
->required(),
TextInput::make('password')
->visible(fn ($livewire): bool => $livewire instanceof CreateRecord), // this will display in the create form only.
]);
}