Filament

F

Filament

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

Join

`->unique()` rule inside relationship instead of whole table

Hey guys, I have this url /{clientSlug}/{productSlug} On ClientResource, I have a ->unique(ignoreRecord: true) on the slug field and this works fine. Now I want to be able to create multiple product with the same productSlug unless they have the same parent (client). I found ->unique(modifyRuleUsing: function (Unique $rule, $record) but I'm not sure how to implement this....
Solution:
I think I got it: ```php Forms\Components\Select::make('client_id') ->relationship('client', 'name') ->required()...

Infolist table repeater or key-value from a relationship?

Hi, Is there a way to display a list of key-values from a has many relationship in an infolist? If not, is there a way to display a table of this relationship? For example, If my infolist was about an Author model, is there an infolist entry I can use to display a list of all the author's books from a related Book model?...
Solution:
Hmm actually, I managed to get there in the end. ```php Infolists\Components\RepeatableEntry::make('grades') ->hiddenLabel()...

How do I close Action modal using $wire when process is done

Hello, I am using a custom Livewire component within ->modalContent for Table Action and it works great. I need to know how to close the modal when the process is finished please? ...
Solution:
add this ```html <div x-data="{ modalId: null, init() {...
No description

Delete a Record intentionally with relationships

Hey everyone. So, I want to manually take care of a record deletion. There's a few relationships involved, and I want to use DB::transactions. I know I could use an Observer, but that's not explicit and I believe it won't use transactions....

How to get the clean state after using mask()?

By using afterStateUpdated, how to get the $state value as unmasked? Because In form when using $this->form->getState() the value gets cleaned. ``` TextInput::make('phone') ->placeholder('Phone Number')...

Action is not called when first clicked on modal with modalContent()

Hi, I have a weird bug where I need to press twice on an action. The first time it does send a request to the server but it is not executing the action. Then every other click on whatever action does instantly open the action. It seems like the action is not loaded/mounted or something. I have attached a video to explain the problem visually. The modal opened is an action with a modalContent() where the content is a livewire component with a table. Any help would be appriciated!...

Full screen editor

I am asking second time this question, first time was not working because it gives me browser full screen not the editor full screen, so it is possible to make full screen editor in filament

Good course on testing?

Are there any good in-depth courses/deep dives on testing within the Filament ecosystem (or even just filament overall). The only course on Filament that I've really seen (aside from just random youtube videos) is on Laracasts, and it's good, but looking for more resources.

resource not displaying on sidebar

hello. i create a resource with this cmd: php artisan make:filament-resource Customer --generate but it is not displaying on sidebar. i added this function in my resource file...
Solution:
Please provide more info about your project, if you did some customizations If you are using cache, you need to clear it https://filamentphp.com/docs/3.x/panels/installation#caching-filament-components...

change fileupload field preview url

can i change the preview url of a uploaded file? dont want to use s3 for preview (only storage )...
Solution:
You'd need to use a getTemporaryUrl method override for the S3 driver where you use a local route which fetches the assets and returns it for you.

Can't login anymore

Since today I cannot login anymore on local for some reason. When clicking login, it just redirects back to the login page with no errors in the console or network tabs. Everything seems to be working fine on staging & production, so it's only local. My current env:...

Change table row background color based on hexadecimal

I would like to show rows on a table where each row will have it's own color from database. The color is defined using hexadecimal, as far as I know FIlament only able to use tailwind color, if it's defined customized from database, is it possible to change the row background color?

How to Fix 'Call to undefined method' Error in Inherited Laravel Model?

I have created a new model in Laravel that extends a model from the vendor directory and added a new method (getNextApprovers) to the new model. However, when calling this method, I receive a Call to undefined method error. I have tried using __call and Traits, but the issue persists. How can I resolve this issue and ensure that the method works correctly in the new model?

How To Register Custom Color to Panel

hi all , i created custom class color in my custom theme . i want to set as primary color in my panel but i received error . any idea ?
No description

Conditional rules not working

Hi, I want to enable custom rules conditionally, but this is not being called. What am I missing here? I have attached the code used below. ``` Forms\Components\Select::make('identification_type') ->label(__('Identification type')) ->options(IdentificationType::class)...

Hide button create & cancel on wizard

hello all, does anyone know how to hide this button on wizard?
No description

Calling a Method Inside a Field Class in Filament v3 from JS

I've implemented a JavaScript function to add a new item to an array of coordinates. When clicking the button, I'm calling @this.call('add'), but it doesn't seem to find the add method in the Form class, even though the method exists inside the Field. How can I use the add method that is defined within the Field class? ``` class TestForm extends Component implements HasForms {...

multiple resources based on same model

i have a users table with a role field. I want to have two resources clients and admins that both use the same table users but with a filter for the role field. how do i achieve this?...
Solution:
You can use ->modifyQueryUsing() and apply differently per resource https://filamentphp.com/docs/3.x/panels/resources/listing-records#customizing-the-table-eloquent-query

Spatie Media File Upload Issue

Hello, Does anyone know how to "insert" image into form. I have this action witch is getting view from Livewire component. And livewire component itself has forms which contain Spatie Media Library. Now the issue is i cannot get that fileupload to attach and preview image.. Any solution?
No description

edit page

I have created a resource in another panel, but it's not appearing in the navigation menu of that panel. I don't have any policies in the models. I have tried ```php protected static bool $shouldSkipAuthorization = true;...