Filament

F

Filament

Filament is a collection of beautiful full-stack components for Laravel.You can get help using it on our Discord.

Join

Setting relationship name for attach action

I have a resource called NotifiableEvent, it has a many to many with NotifiableUsers. I have a relationmanager on the Event resource, which points to NotifiableUsers, but the relation in the model is defined as 'events', but I get this error when I click the default attach action Call to undefined method App\Models\NotifiableUsers::notifiableEvents() How can I tell it to look for the 'events' defined relation function instead?...

Delete Item in Repeater

Hi All, When I tried to implement deletable in my Repeater, I wanted to make a condition if this item's addable_id is 1, return false; other wise return true. I did this, but it is not working for me ->deletable(fn (array $state): ?string => $addable_id['name'] == 1 ?? false),...

How to authorize ManageRelatedRecords viewAny based on parent record in Filament?

Hi folks — I’m trying to manage viewAny authorization for a ManageRelatedRecords page, but based on the parent/owner record. Context: Parent model: Project...

Custom Page - Modals and more

I'm creating a little vision-goals-tasks solution for myself. Just to learn / experience filament. One thing that I wanted to do was creating a custom page where I show the different visions, below I want to have panels showing the goals. Inside the panels I also wanted to have the tasks for each goal. And probably some more as well. I also wanted to add a task using a modal. Well, that almost worked. I got the modal up (eventually), but it was really narrow. ...

Workaround for deleteOptionAction

In Filament, we have a createOptionAction to add new values to a Select which is related to another model. Also, we have an editOptionAction. But we have not a deleteOptionAction. So I tried to add a delete button inside the editOptionAction using . The button renders fina, but it simply doesn't do anything. Here is my code so far: ```php Select::make('uom_category_id') ->relationship('category', 'name')...

Spatie Media not available in the afterCreate lifecycle hook

I noticed that Spatie media isn't accessible in the afterCreate() function of CreateRecord. Is there another way to access it? I want to update the custom properties.

Spatie Media Library Custom Properties Per Image

I enabled multiple file uploads in my form. Now, what I want to do is set different custom_properties values for each image. How can I achieve that?

Enum select key is not the constant but the value

I tried to make a Select field in my form with an Enum. I used this documentation for it: https://filamentphp.com/docs/3.x/support/enums#enum-labels But when it is saved the values writing into the database, not the constant, what is the expected behavior (I think). Here is the Enum: https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Enums/County.php Here is the Model (where is the form and the cast): https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Models/City.php And of course the resource what is using getForm from the model: https://github.com/sajt/iingatlanegyszer-filament/blob/main/app/Filament/Resources/CityResource.php...
Solution:
I needed somyhing like this: case BUDAPEST = 'BUDAPEST';

Livewire Table component in a action modal

How can I pass a Livewirre component that contains a table, into the modal content of my action?

Poll Entire page

I have a Job table and a JobDetails table. In filament, there is a JobResource and a JobDetailsRelationManager. This means that the Job view page shows an infolist for the Job and a table for all the JobDetails. This all works correctly. However, I would like the entire page to poll every [10] seconds if the Job status is pending. I can easily get the infolist to poll using the following code, but how do I apply this to the JobDetails as well?...

how to create a pagination summary .

I want to create a pagination summary like the one in the attached image. I have tried the below code, but it is not working . ```php use Filament\Tables\Table; ...

Redirecting After Login based on user's role

I'm currently using Filament with Laravel 11, and I’ve set up a single admin panel provider with the login page located at /admin/login. On this page, users with different roles—such as admin, superadmin, and user—can log in. The issue I'm encountering is that users with the user role are being redirected to the admin panel (/admin) after logging in, which shouldn't happen. For admin and superadmin roles, the redirect to /admin is expected and works correctly. The problem specifically occurs when a regular user logs in—they’re still taken to the admin panel. For context, I'm also using Filament Shield in this setup....

How load related record on repeatable entry (sorry for bad english)

Hi ! I can create a resource for suppliers that have a relationship with products. In my repeatable entry I have a button for each product, which opens a modal and in this modal I need to say in the first TextInput what the category of the selected product is, but when I pull the record in the function, the supplier comes and not the product from the repeatable entry. my code:``` RepeatableEntry::make('products') ->columns(2) ->schema([...
No description

Spatie Media Library

always get this error App\Models\Repair::Spatie\MediaLibrary{closure}(): Argument #1 ($mediaItem) must be of type Spatie\MediaLibrary\MediaCollections\Models\Media, string given ``` Components\Section::make('Images')...

Missing namings on using panel in table builder

```php public function table(Table $table): Table { return $table ->query(...
Solution:
This is expected because Split, Stack, ... remove the classic table layout and therefore there are no headers anymore.
No description

Bind class on action button ?

Try to implement class on using x-bind:class ``` Action::make('export') ->accessSelectedRecords()...
Solution:
try
'x-bind:class' => new HtmlString("{ '!bg-danger-100': selectedRecords.length === 0 }")
'x-bind:class' => new HtmlString("{ '!bg-danger-100': selectedRecords.length === 0 }")
...

SpatieMediaLibraryFileUpload gets images from a third-party AP.

Is it possible to have a button that retrieves images from a third-party API, and once the photos are fetched, automatically attach them to the SpatieMediaLibraryFileUpload form field?

Export action

I'm trying to export using the exported generator following this guide: https://filamentphp.com/docs/3.x/actions/prebuilt-actions/export Laravel 11 Filament 3.2.23 The issue that I have is that sometimes when exporting it includes not related that or unwanted rows. I've thought it could be because of mix relations in the columns, but even with just the columns that are autogenerated it mix the data and adds unwanted data. ...

add action to group header table

im trying to add delete action button to group header at table but its not working, it only do quick spin and then back to normal state. what i do to render the action button is make function in ListRecord ```php public function renderGroupDeleteAction($id)...
No description