H4L1M
H4L1M
FFilament
Created by H4L1M on 10/26/2024 in #❓┊help
Redirect to Profile On UsersRessource
Am trying to redirect the user to his own profile if he's trying to view or edit his own record on UsersRessource Am hiding his record with ModifyQueryUsing on $table on UsersRessource But a user can just edit the URL to access his resources (Not talking about Authorisation) I want to redirect to the Profile page if the user tries to view or edit his own User Model Any help ?
5 replies
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