Filament

F

Filament

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

Join

How to decrease this gap in collapsed sidebar

why this is so big, how to make it smaller?
No description

Save column visibility in user preferences

Column visibility works great, but is lost between sessions. It would be awesome if there were some kind of callback or event that is triggered when a column's visibility changes. That way I could save the users table preferences and reload the next time they login. Is this possible?...
Solution:
If anyone else searches for this, apparently this is doable by creating a custom trait. Adding methods to the trait to override Filaments "getDefaultTableColumnToggleState()" to get the toggled columns state and "updatedToggledTableColumns()" to update the state. Added some code to both of those to read/write from a custom table...

Change relation manager label

Does anyone know how I change this Edit label when I have a Combined relation manger tabs active? Thanks.
No description

Can't use $get inside recordSelectOptionsQuery: any workaround?

Hi, I didn't find the answer on this discord, nor in the docs. What I'm trying to do: Modify the query of the attach action select based on another field ...

Count chars field not working

I want to create a column that shows the length of the field title: ```php TextColumn::make('Title') ->formatStateUsing(function ($record) {...
Solution:
TextColumn::make('title')
->formatStateUsing(fn (string $state): string => strlen($state))
TextColumn::make('title')
->formatStateUsing(fn (string $state): string => strlen($state))
...

Filament v3 w. Laravel 11 and AWS hosting

Hi, usually our frontends are hosted on S3 buckets, however with Filament it is directly linked to our API, and therefor also our API URL, i.e. api.xxxx.com/<some-filament-route>. I was wondering if there is a way around this? Right now I have set up a CNAME that refers to the Filament origin in AWS, however it basically just redirects. My main thought is that I wanted to use a more descriptive name than api.xxxx.com/<some-filament-route> Do you have any inputs? Thanks!...

TipTap Editor Issue

Hi guys, is there a way to remove these "plugins" if they go by that name, because as soon as i start typing they appear and i want to remove them?
No description

Get state from form to createOptionForm

I want to get the person_type state from the form to the createOptionForm modal, I've tried $get('../person_type') or '../../' but it does not work. ```php Radio::make('person_type') ->label(__('Person Type')) ->options(PersonType::class)...

Saved data not showing in multiselect field

What I am trying to do: Displaying the data that is picked from the multiselect. What I did: Made a new column in the database:...

How to add a CreateAction in the headerActions of resource A, to create a record in resource B?

I want to allow users to easily create a record in resource B, on the List page of resource A in its tables headerActions. I would also prefer to use the existing form from resource B as well as it's create lifecycle hooks, if possible. Basically, I want to open the existing create page of resource B in a modal by clicking an action button, which does the exact same as the existing create page does. Is this possible? I tried to use Filament\Actions\CreateAction on a tables headerActions just to test if this would open a create modal when clicked like this: ```php...

Can you access the search state in a create action?

Sorry if the title doesn't make much sense I have a select like this ```php Select::make('user_id')...

Close modal from a "extraModalFooterActions"

I have a table with a Filament\Tables\Actions\Action action that opens a modal. This modal also has a extraModalFooterActions action which works as expected. I want the modal to close when the extraModalFooterActions action is completed, how can I go about this? I can't seem to find a way to give the modal a custom ID or retrieve the modals ID to be able to dispatch a close event. This is my current code:...
Solution:
I think you just need to use makeModalSubmitAction() here. have you read this: https://filamentphp.com/docs/3.x/actions/modals#adding-an-extra-modal-action-button-to-the-footer...

Show both an infolist and a form on a RelationManager modal

If I define infolist() on a RelationManager class, I get a modal with an infolist. If I define form() I get a form. But if I define both, I don't get both but only the infolist. Any quick fix for this? Do I need to override the view for this or is there a simpler solution?

Add a trait to every filament page

My project is entirely filament. I recently discovered a package that wants me to use a trait in each of the Edit, View, List or Create pages. Is there a way to boot every page always with that trait?

How to remove createAnother button from createOptionAction modal?

In a Form Select field, when I want to add the abilitiy to create another option on the relationship, it only makes sense in some cases to add one extra option that needs to be selected by the select field. Here I do not want to see the "Create & create another" action in my modal, as this only confuses the end user. This does not work: ```php ->createOptionAction(function (Action $action) {...
Solution:
Okay, so that cleared it up. in the getCreateOptionAction() method in the filament/packages/forms/src/Components/Select.php class, an extra modal footer action is added conditionally: ```php ->extraModalFooterActions(fn (Action $action, Select $component): array => $component->isMultiple() ? [ $action->makeModalSubmitAction('createAnother', arguments: ['another' => true]) ->label(__('filament-forms::components.select.actions.create_option.modal.actions.create_another.label')),...

Searchable MorphTo

I want to make a column searchable: ```TextColumn::make('model.name') ->url(function (BankAccount $record): string { if ($record->model instanceof Project) {...
Solution:
Having a relation named 'model' seems like it might break something, or at the very least be confusing. I'm not sure on your specific error here, but you can pass a closure to searchable() and override the query to search specific columns of your MorphTo models. ```->searchable( query: fn ( $query, string $search) => $query ->orWhereMorphRelation(...

curator filament plugin view

why is the view like this? everything is out of place.
No description

Missing understanding about mutate data in repeater

can anyone explain about how to use three of above in repeater - mutateRelationshipDataBeforeCreateUsing - mutateRelationshipDataBeforeFillUsing - mutateRelationshipDataBeforeSaveUsing...
Solution:
Before create = adjust the relationship data before creating the records in the relationship before fill, is before filling the data into the form from the relationship before save, is when saving the data in editing etc....

Rendering widgets on multiple dashboard

Hi everyone, I'm working on a Filament project with two separate dashboard pages under the same admin panel: /admin/dashboard for general dashboard widgets...

table filter icon - add text after or before icon

Hello, Is it possible to insert text next to or before the table filter icon?...
Solution:
```php $table ->filtersTriggerAction( fn (Action $action) => $action->button()->label('New Filter Name') );...