H4L1M
H4L1M
FFilament
Created by H4L1M on 2/23/2024 in #❓┊help
Notification not working from Action Component
hello , I have this small action the notifications fail to lunch with no errors showed , the action works
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('triggerBanLogic')
->label('Ban')
->successNotificationTitle('The user has been successfully banned.')
->failureNotificationTitle('failed')
->closeModalByClickingAway(false)
->modalHeading('Ban User')
->icon('heroicon-o-no-symbol')
->color('danger')
->form([
Forms\Components\Group::make()
->schema([
Forms\Components\Radio::make('banType')
->label('')
->required()
->live()
->columnSpan(1)
->default('PermanentBan')
->options([
'PermanentBan' => 'Permanent Ban',
'TemporaryBan' => 'Temporary Ban',
]),
Forms\Components\DatePicker::make('expires_at')
->label('Ban until')
->required()
->displayFormat('d/m/Y')
->closeOnDateSelection()
->visible(fn (Get $get) => $get('banType') === 'TemporaryBan')
->minDate(now()->addDay()),
Forms\Components\TextInput::make('comment')
->label('Comment (Ban Reason)')
->required()
->columnSpanFull(),
])->columns(2)
])
->action(function (array $data, User $record) {
$data['banned_by'] = auth()->id();
$record->ban($data);
})
])->fullWidth()
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('triggerBanLogic')
->label('Ban')
->successNotificationTitle('The user has been successfully banned.')
->failureNotificationTitle('failed')
->closeModalByClickingAway(false)
->modalHeading('Ban User')
->icon('heroicon-o-no-symbol')
->color('danger')
->form([
Forms\Components\Group::make()
->schema([
Forms\Components\Radio::make('banType')
->label('')
->required()
->live()
->columnSpan(1)
->default('PermanentBan')
->options([
'PermanentBan' => 'Permanent Ban',
'TemporaryBan' => 'Temporary Ban',
]),
Forms\Components\DatePicker::make('expires_at')
->label('Ban until')
->required()
->displayFormat('d/m/Y')
->closeOnDateSelection()
->visible(fn (Get $get) => $get('banType') === 'TemporaryBan')
->minDate(now()->addDay()),
Forms\Components\TextInput::make('comment')
->label('Comment (Ban Reason)')
->required()
->columnSpanFull(),
])->columns(2)
])
->action(function (array $data, User $record) {
$data['banned_by'] = auth()->id();
$record->ban($data);
})
])->fullWidth()
4 replies
FFilament
Created by H4L1M on 2/22/2024 in #❓┊help
Save Action in a separate file
hello , can I save the actions in a separate file to use it in multiple places and avoid code duplication.. thank you ..
6 replies
FFilament
Created by H4L1M on 2/17/2024 in #❓┊help
Form Component Placeholder
hello, can placeholder's text colors be changed ? red and bold for example
Placeholder::make('User Status')
->content('Banned at : 02-17-2024 14:50 By Admin')
Placeholder::make('User Status')
->content('Banned at : 02-17-2024 14:50 By Admin')
5 replies