dwiser
dwiser
FFilament
Created by dwiser on 2/19/2024 in #❓┊help
CreateBulkAction plugin?
Has anyone created a table action button to bulk create relationships from the selected parent records? I have a table of projects that I would like to bulk select and create a new relationship for each of them. Has anyone created something similar?
1 replies
FFilament
Created by dwiser on 2/16/2024 in #❓┊help
Action button for creating relation on view page
I'm trying to duplicate the CreateAction button that is created with a RelationManager so that I can add it to the top of a ViewRecord page. I got myself most of the way there with associating a model and reusing the Resource form but I'm not sure how to pass the record of the ViewRecord page to the form and also hide the select element in the form that pertains to the record being viewed.
// Resources\ProjectResource\Pages\ViewProject->getHeaderActions():
return [
...
Actions\CreateAction::make()
->model(Shift::class)
->label('Add Shift')
->form(fn (Forms\Form $form) => ShiftResource::form($form)),
...
];

// Resources\ShiftResource::form(Forms\Form $form):
return $form
->schema([
...
Forms\Components\Select::make('project_uuid')
->required()
->relationship(name: 'project', titleAttribute: 'name')
->searchable()
->preload()
->optionsLimit(20)
->columnSpan([
'sm' => 2,
'xl' => 3,
])
->hiddenOn(ProjectShiftsRelationManager::class),
...
]);
// Resources\ProjectResource\Pages\ViewProject->getHeaderActions():
return [
...
Actions\CreateAction::make()
->model(Shift::class)
->label('Add Shift')
->form(fn (Forms\Form $form) => ShiftResource::form($form)),
...
];

// Resources\ShiftResource::form(Forms\Form $form):
return $form
->schema([
...
Forms\Components\Select::make('project_uuid')
->required()
->relationship(name: 'project', titleAttribute: 'name')
->searchable()
->preload()
->optionsLimit(20)
->columnSpan([
'sm' => 2,
'xl' => 3,
])
->hiddenOn(ProjectShiftsRelationManager::class),
...
]);
5 replies
FFilament
Created by dwiser on 10/6/2023 in #❓┊help
$set all checked in nested CheckboxList
I am creating a form section visually similar to the bezhansalleh/filament-shield package but for project notification options instead of spatie permissions. When creating a user, there is a Section for every project, each including a Toggle and a CheckboxList to choose individual notifications or all in bulk. Changing the Toggle will update all the Checkboxes to the same state and unchecking any one Checkbox will change the Toggle to off. I can't seem to find a way to reference each individual CheckboxList item using $set. A bulk toggle of the checkbox list would likely solve my issue but I'm using the opportunity to better understand filament and keep the preferred UI instead of fall back to the bulk toggle method.
5 replies