F
Filamentβ€’5mo ago
d3v1anX

Standard Create Action in modal

Hey guys, I want to get the standard action for creating an entry in a resource to get this into a modal. I already got this by removing the create route in getPages().
public static function getPages(): array
{
return [
'index' => Pages\ListInvitations::route('/'),
// 'create' => Pages\CreateInvitation::route('/create'),
'edit' => Pages\EditInvitation::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListInvitations::route('/'),
// 'create' => Pages\CreateInvitation::route('/create'),
'edit' => Pages\EditInvitation::route('/{record}/edit'),
];
}
Is this intended? Or is there a better way? The problem is now I don't know how to handle the record creation before saving.
Solution:
Ok first for creating new user with an action.. If you want to do it from your list Page. you can add a getheaderActions() on the page class. Then use Filament\Actions\Action::make('new user'') ->form([ // create your form here using Filament\Forms ])...
Jump to solution
5 Replies
sir_abdull
sir_abdullβ€’5mo ago
If I understand clearly you want to create a user with just a modal I.E not redirecting to a create page.
d3v1anX
d3v1anXOPβ€’5mo ago
yes, that’s correct πŸ‘ but I want to add an extra field to the model after validation before saving πŸ™‚
Solution
sir_abdull
sir_abdullβ€’5mo ago
Ok first for creating new user with an action.. If you want to do it from your list Page. you can add a getheaderActions() on the page class. Then use Filament\Actions\Action::make('new user'') ->form([ // create your form here using Filament\Forms ]) ->action( // your logic to create user here. ) //you can chain further methods as required
sir_abdull
sir_abdullβ€’5mo ago
You can do the same from a table Action.
d3v1anX
d3v1anXOPβ€’5mo ago
I am stupid πŸ˜„ I didn't had a look into the ListInvitation-class. All the time I looked into the Create class - thank you for pointing me to the right direction πŸ™‚
Want results from more Discord servers?
Add your server