tidiani12
How to create submission confirmation modal in admin panel like requireConfirmation in delete action
I tried to do that way but I just got a notification
protected function beforeCreate(): void
{
Notification::make()
->title('Saved successfully')
->success()
->body('Changes to the post have been saved.')
->actions([
Action::make('view')
->button(),
Action::make('undo')
->color('gray')
])
->send();
$this->halt();
}
protected function beforeCreate(): void
{
Notification::make()
->title('Saved successfully')
->success()
->body('Changes to the post have been saved.')
->actions([
Action::make('view')
->button(),
Action::make('undo')
->color('gray')
])
->send();
$this->halt();
}
2 replies
How to get record of select relationship automatically
Select::make('type_infrastructure_id')
->relationship(name: 'typeInfrastructure', titleAttribute: 'nom')
->createOptionForm([
Forms\Components\TextInput::make('nom')
->required(),
Toggle::make('surface')
->onColor('success')
->offColor('danger'),
Toggle::make('circular')
->onColor('success')
->offColor('danger'),
Toggle::make('volume')
->onColor('success')
->offColor('danger'),
]),
TextInput::make('longueur')
->hidden(fn(\Filament\Forms\Get $get) => $get('type_infrastructure_id') ? $type_infrastructure_id->name === '///here' : true),
Select::make('type_infrastructure_id')
->relationship(name: 'typeInfrastructure', titleAttribute: 'nom')
->createOptionForm([
Forms\Components\TextInput::make('nom')
->required(),
Toggle::make('surface')
->onColor('success')
->offColor('danger'),
Toggle::make('circular')
->onColor('success')
->offColor('danger'),
Toggle::make('volume')
->onColor('success')
->offColor('danger'),
]),
TextInput::make('longueur')
->hidden(fn(\Filament\Forms\Get $get) => $get('type_infrastructure_id') ? $type_infrastructure_id->name === '///here' : true),
7 replies
Property null after submit
Hi I use the radio input and my select is hidden if all option is chosen but if I chose multi-select option $farmId is always null but if I remove the function hidden it is okay
Section::make('Select Farm')
->schema([
Radio::make('type')
->reactive()
->options([
'all' => 'All',
'multi-select' => 'Multi Selection',
]),
Select::make('farmId')
->multiple()
->reactive()
->hidden(fn(\Closure $get) => $get('type') == 'all')
->label('Ferme')
->options(Ferme::all()->pluck('name', 'id'))
->searchable(),
]),
Section::make('Select Farm')
->schema([
Radio::make('type')
->reactive()
->options([
'all' => 'All',
'multi-select' => 'Multi Selection',
]),
Select::make('farmId')
->multiple()
->reactive()
->hidden(fn(\Closure $get) => $get('type') == 'all')
->label('Ferme')
->options(Ferme::all()->pluck('name', 'id'))
->searchable(),
]),
5 replies