Filament

F

Filament

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

Join

Filament custom rules, in rules folder or forms/components.

Hi, I need to reuse some rules in a filament resource and I was wondering if I should put them in the default Laravel rules folder or the app/forms/components folder. Thanks

Table: How to position bulk action checkbox?

Hey there, is it possible to change the position of the bulk action checkbox? Like placing it at the end of the table? Imagine something like Todolists in a table where each task can be marked as completed (see Screenshot). The checkbox for bulk actions and the checkbox to set a task as completed are close together which could be a UI/UX problem - especially on mobile devices. Is it possible to change the position of the bulk action checkboxes?...
No description

Unable to find component when clicking on an action

I have a custom action in a custom Filament page: ```php // ......

Hint action disappear.

```php Forms\Components\Select::make('client_id') ->native(false) ->preload() ->live()...
Solution:
```php Select::make('client_id') ->options([ 1 => 'Option 1', 2 => 'Option 2',...

Custom Filter for Date in Relationship not working properly

Hello, I am trying to filter the records as per the date field in the relationship (belongsTo), which filters wrong records. Booking Model - Relationship:...
No description

use CMS authMiddleware

I am using Statamic CMS hand in hand with filament, statamic allows admins to impersonate users however, i cant figure out the auth to allow the admin to impersonate the user on statamic and then move over to the filament side and still be impersonating the user (at the moment it logs them out). I have tried using statamic authGuard in authMiddleware() in the adminPanelProvider and defining the authGuard but neither have worked. Is it possible for this to work?...
Solution:
for anyone who encounters this issue - statmic and filaments middleware has some clashes so you just need to remove the filament middleware that is already provided by statamic

make date range filter inline

I want to make the date range to be in the same row right now it looks like the Test To field is below the Test From here is my filter ```...
Solution:
@roy21 if these are the only fields, you can just add ->columns() to the Filter ```php Filter::make('test_date_range') ->columns() ......
No description

dynamic colspan for resource form

Hi, I wonder is there any dynamic way to set form colspan, the scenario is like we have 2 or 3 column form and when we click a button/action the colspan become 1, it would be usefull if we use Richtext for editing the content
Solution:
hidden field with default value, then fn($get) => $get('hidden_field') in the colspan and get the hidden field value. then in the action set the hidden field value

How to get real-time validation error before clicking create/save button

``` Forms\Components\DateTimePicker::make('start_date') ->label('Start Date') ->required() ->rules([ fn (): Closure => function (string $attribute, $value, Closure $fail) {...

Standard Create Action in modal

Hey guys, I want to get the standard action for creating an entry in a resource to get this into a modal. I already got this by removing the create route in getPages(). ...
Solution:
Ok first for creating new user with an action.. If you want to do it from your list Page. you can add a getheaderActions() on the page class. Then use Filament\Actions\Action::make('new user'') ->form([ // create your form here using Filament\Forms ])...

Time Difference

how can i implement difference of time here.
No description

How to handle image preview on edit if the image is from relationship

In our setup, all images is stored in file tables for dynamic purposes.. the create is ok but on edit I want to show the stored image on that record relationship ``` public function photo(): \Illuminate\Database\Eloquent\Relations\BelongsTo...
No description

Table list edit query based on certain conditions

Hi I was going to use getTableQuery for this (see ListRecords) but it seems to be deprecated https://github.com/filamentphp/filament/blob/9fce05403fba5db54994e5ffd302a635e4ebad1d/packages/panels/src/Resources/Pages/ListRecords.php#L322, how else would you approach this? Modifying the query from a resource gets undone when livewire updates (pagination, poll,...) happen....

custom page edit: unable to find component

I have followed the instructions to build a custom edit page to edit some specific fields of a record in its simplest way: ```php <?php ...

Issue with Dependent Select for MorphToSelect

In my CouponResource.php page, I am trying to have dependent select for 'assigned_to' field. I am experiencing very slow load while assigning 'assigned_to' field. ``` Group::make() ->relationship('advertisement')...

[Group] Using table id as the key, but display the name at the table

I want to group my table by classroom.id, but when displaying the grouping at the table, it should show the classroom.name for example something like this return $table ->query($query)...
Solution:
of found it, I can use column()

For a custom filament page to edit a specific eloquent model, what is the URL of that page?

I haven't found any explanation how to find out the URL of a custom edit page of an Eloquent model. Is the URL based on the namespace and class name and panel? ```php <?php...

Color Picker JavaScript Change Event

I'm trying to add a live preview of an element that uses a custom color defined in a filament ColorPicker. In javascript I'd like to add an event listener on the input which runs whenever the value of the input is changed. picker.addEventListener('input', () => {...}) only triggers when the value is manually changed by typing on the keyboard. But if the input value is changed by dragging around on the color picker popup, the event is not triggered. Is there some other javascript event that is dispatched whenever someone drags on the color picker popup, or is there some other way to hook into that?...

How to validate two fields combined are unique

Here i need to validate the name and size_id are unique, i could do it in laravel but how could i in filamentphp. Thanks for answering `schema([ TextInput::make('name')->label('Nombre')->required(), TextInput::make('purchase_price')->label('Precio de compra')->required()->numeric(), TextInput::make('sale_price')->label('Precio de venta')->required()->numeric(),...

Disabled class not working ON INPUTS

Hello, I'm experiencing an issue with Filament 3 in Laravel. I'm trying to set the cursor-not-allowed class when the user submits the form, but instead of the disabled class being applied, the readonly class is being applied. When inspecting the element with the fi-input class, I found that the disabled: classes are present....
No description