mcdc
mcdc
FFilament
Created by mcdc on 5/6/2025 in #❓┊help
How to customize
No description
3 replies
FFilament
Created by mcdc on 5/7/2023 in #❓┊help
Repeater: Get current form id
I have this task table where fields are id, title, description, creator_id, due_date, parent_id, type I added Repeater on my $form , my goal is I want create sub task, which is determine by type and also under what main task parent_id. How to get the id and assign it as default on my TextInput::make('parent_id')
return $form
->schema([
TextInput::make('title')
->required()
->autofocus(),
Forms\Components\MultiSelect::make('user_id')
->label('Assigned to')
->relationship('assignees','user_id')
->multiple()
->options(User::pluck('name','id')->toArray()),
DatePicker::make('due_date')
->label('Due Date')
->minDate(now()),
TextInput::make('creator_name')
->label('Created by')
->default(auth()->user()->name)
->disabled()
->hint('Creator: '.auth()->user()->name)
->hintIcon('tabler-info-circle'),
TextInput::make('creator_id')
->default(auth()->user()->id)
->hidden(),
Textarea::make('description')->required(),
Forms\Components\Repeater::make('subtask')
->schema([
TextInput::make('title')->required(),
Textarea::make('description')->required(),
TextInput::make('parent_id')
->default() // this id of the task
->hidden(),
])
->createItemButtonLabel('Add subtask')
->collapsed()
]);
return $form
->schema([
TextInput::make('title')
->required()
->autofocus(),
Forms\Components\MultiSelect::make('user_id')
->label('Assigned to')
->relationship('assignees','user_id')
->multiple()
->options(User::pluck('name','id')->toArray()),
DatePicker::make('due_date')
->label('Due Date')
->minDate(now()),
TextInput::make('creator_name')
->label('Created by')
->default(auth()->user()->name)
->disabled()
->hint('Creator: '.auth()->user()->name)
->hintIcon('tabler-info-circle'),
TextInput::make('creator_id')
->default(auth()->user()->id)
->hidden(),
Textarea::make('description')->required(),
Forms\Components\Repeater::make('subtask')
->schema([
TextInput::make('title')->required(),
Textarea::make('description')->required(),
TextInput::make('parent_id')
->default() // this id of the task
->hidden(),
])
->createItemButtonLabel('Add subtask')
->collapsed()
]);
4 replies
FFilament
Created by mcdc on 4/25/2023 in #❓┊help
Restrict user to view certain Navigation Group
How to restrict other user/acc with type user from viewing NavigationGroup::make('Admin') and only user with type admin https://filamentphp.com/docs/2.x/admin/navigation#advanced-navigation-customization
Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder
->groups([

NavigationGroup::make(null)
->items([
NavigationItem::make('Dashboard')
->url(route('filament.pages.dashboard'))
->icon('tabler-chart-treemap'),
NavigationItem::make('Timer')
->url('/app/users/timer')
->icon('tabler-clock-hour-3')
->sort(2)
]),

NavigationGroup::make('Admin')
->items([
NavigationItem::make('Users')
->url('/app/users')
->icon('heroicon-o-user-group')
->sort(1),

NavigationItem::make('Roles')
->url('/app/shield/roles')
->icon('heroicon-o-shield-check')
->sort(2),

NavigationItem::make('Task')
->url('/app/tasks')
->icon('tabler-subtask')
->sort(3),
]),
...,
...,
]);
});
Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder {
return $builder
->groups([

NavigationGroup::make(null)
->items([
NavigationItem::make('Dashboard')
->url(route('filament.pages.dashboard'))
->icon('tabler-chart-treemap'),
NavigationItem::make('Timer')
->url('/app/users/timer')
->icon('tabler-clock-hour-3')
->sort(2)
]),

NavigationGroup::make('Admin')
->items([
NavigationItem::make('Users')
->url('/app/users')
->icon('heroicon-o-user-group')
->sort(1),

NavigationItem::make('Roles')
->url('/app/shield/roles')
->icon('heroicon-o-shield-check')
->sort(2),

NavigationItem::make('Task')
->url('/app/tasks')
->icon('tabler-subtask')
->sort(3),
]),
...,
...,
]);
});
11 replies
FFilament
Created by mcdc on 4/4/2023 in #❓┊help
Store data to pivot table
How do I call or store some data to my pivot_table task_user public static function form(Form $form): Form { return $form ->schema([ TextInput::make('title')->required(), TextInput::make('description')->required(), Forms\Components\MultiSelect::make('assignee_id') ->label('Assigned to') ->multiple() ->options(User::pluck('name', 'id')->toArray()), TextInput::make('creator_id') ->label('Creator') ->default(auth()->user()->id) ->disabled() ->hint('Creator '.auth()->user()->name) ->hintIcon('tabler-info-circle'), DatePicker::make('due_date') ->label('Due Date') ->minDate(now()) ]); } So I want those assignee_id to be store on my task_user table I did try this one out, and seems like I cant figure it out https://filamentphp.com/docs/2.x/admin/resources/relation-managers#creating-with-pivot-attributes
4 replies
FFilament
Created by mcdc on 3/30/2023 in #❓┊help
Display only `filament-badgeable-column` and not the default `table value`
3 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
It will be good idea to have fully custom multiple header action, i dont know if its already there, but I tried its not working use AlperenErsoy\FilamentExport\Actions\FilamentExportHeaderAction; ->headerActions([ FilamentExportHeaderAction::make('Export')->defaultFormat('pdf')->label('Export PDF'), FilamentExportHeaderAction::make('Export')->defaultFormat('xlsx')->label('Export Excel'), FilamentExportHeaderAction::make('Export')->defaultFormat('csv')->label('Export CSV') ]) https://github.com/alperenersoy/filament-export/issues/66
28 replies
FFilament
Created by mcdc on 3/27/2023 in #❓┊help
How to hide custom navigation menu for my regular user? and only admin can see it
private function configureAdminMenu() { Filament::navigation(function (NavigationBuilder $builder): NavigationBuilder { return $builder->item( NavigationItem::make('Dashboard') ->url(route('filament.pages.dashboard')) ->label('Dashboard') ->icon('heroicon-o-home')) ->groups([ // hide this to regular user NavigationGroup::make('Authentication') ->items([ // hide this to regular user NavigationGroup::make('System') ->items([ NavigationItem::make('Application Health') ->url(route('filament.pages.health-check-results')) ->icon('heroicon-o-heart') ->sort(1), NavigationItem::make('Backups') ->url('/admin/backups') ->icon('heroicon-o-cog') ->sort(2), ]), ]); }); }
2 replies
FFilament
Created by mcdc on 3/23/2023 in #❓┊help
Appearance
How do I adjust search bar position from right to left, or is there any way to hide it?
7 replies