Filament

F

Filament

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

Join

multi-tenant: It doesn't filter everwhere

I'm a newbie at Filament, but have the basic many-to-many relations in my tables working and in the UI. Now I've added multi-tenant, and have it working in the UI for my Resources by including this in the top of each Resource Class: protected static ?string $tenantOwnershipRelationshipName = 'team';. This works well when I am into the UI for reach Resource, but when I am on the default Admin page and have added widgets with this code, it seems to ignore the multi-tenant filter. Or maybe I need to add a Global Scope to filter it? This is the code that is not filtering (eg. shows all records) - any clues?:...

Pros/Cons in using Resource class vs *Record classes

I'm curious what the best practices are around, for example, using form() in ThingResource::form versus CreateRecord::form? (also, table(), etc...) My ASSUMPTION is that when you have a relatively simple application you can just leave everything in the Resource class, but if your application is more complex, you can break it out into Pages for easier management. Is that correct? Which leads to a second opinion question: If I use the *Record classes one resource (versus the monolithic Resource class aproach), should I do that for all resources to maintain consistency?...
Solution:
I would stick to the resource class unless your create and edit forms are that drastically different. Keeps from having to repeat the fields. Most of the field modifiers accept callback functions which get the create or edit $operation injected so if it’s only like one or 2 fields you can manage it in the resource class. For example:...

Confused on how to handle sorting in Filament and Laravel

I am rewriting, a old application that reuire the sorting of record both for full table or in groups like categories and subcategories so far i looked at this package : https://github.com/ninoman/laravel-sortable/tree/master and this package from Filament: https://filamentphp.com/plugins/ibrahim-bougaoua-sort-order...

weird question - dynamically generated tailwind config file after form submission

So I have a cms where you can set global styles (not impacting my panels) I created a dynamically generated tailwind command that runs after form submission, but that won't impact the front end since it needs to run npm run build or have watch running, is this a terrible idea or is there a way to do this?

Avatar from google not showing in edit form

hello guys i want to ask, I took the avatar according to what is in each google account, how do I display the avatar in the edit form? then, for example, if you only edit the name, it becomes a null avatar field ...
No description

[Missing parameter: tenant] On custom tenant page ?

Hello I have Tenant Panel and I added Custom page to let user complete registration with addional required details after register so it before create new Workspace Tenant but custom page require tenant pram which is not available yet to provide I have tried to simulate the way how register tenant work but i can't. Here's created page ```...
No description

Simple Multi-Tenancy and billing

I am trying to set up multi-tenancy on my project but I'm having trouble with understanding the documentation. Mainly my issue is the following. In multi-tenancy it tells you to not use the ->tenant(Team::class); if you only have a simple one-to-many tenancy which I do have, but I fail to understand how I would use the ready-made solution to Laravel Spark since it uses ->tenantBillingProvider() (https://filamentphp.com/docs/3.x/panels/tenancy#using-laravel-spark) if I don't have the ->tenant() in the first place. My tenant model is Account which has many Users and that's it....

Displaying Custom Model attributes in a table

Before I upgraded to V3 I was able to access my custom attribute by like so
TagColumn::make('triggers.definedName)
TagColumn::make('triggers.definedName)
but since upgrading this seems to no longer work....
Solution:
Fixed it by changing my attribute to look like this ``` public function getDefinedNameAttribute() { if ($this->machine_status_id != null) {...

Resource visible in sidebar even if `viewAny()` returns false

As per title, I have a resource that's only available to certain users. According to the docs here https://filamentphp.com/docs/3.x/panels/resources/getting-started#authorization the link should not be visible if they don't have access to it. However, that's not the case for me. They can still see the link but they get a 403 when trying click on it (as expected) The navigation menu is build 'manually'...

export successful no notification

I am running a bulk action export and the process ends with a promise of a download notification and download link. The data shows up in storage/app/public/filament_exports/ But the notification never comes. ...

text column parses large number as float

Is there any reason why a large number (for axample 3153414733313030323138383038 gets seen as a large number like 3.153414733313E+27 instead of just a string when using textColumn? When I add in my DB an A in front of the number it works just fine?

Filapanel users not able to login

Hi guys. Is there anyone using Filapanel. I thought it is amazing. I’m having a challenge though, after I follow all instructions to run on localhost, I can’t login. I create a user with php artisan make:filament-user but I still can’t login. I even tried their templates without changing anything and still same issue. Can anyone help me?

Is it possible to have a required (non-nullable) Select Form Component?

I've added ->nullable(false) which adds an asterisk to the input, but I'm still able to remove the value from the select. Is there a way to avoid this? I'd love for nullable(false) to remove the x from the select box
Solution:
Oh balls - I just re-read the docs and found what I was looking for. In case anyone else comes across this post, what you need is ->selectablePlaceholder(false)...
No description

Default entry point at login

It would appear something somewhere is remembering the last resource\page that a user was on when they logout, and then going back to that when they re-login. A useful feature, but not always, how to switch it off?...

How to completely override the search query for Select while also using relationship?

By default the search query uses LIKE and i would like to use full text search due to the amount of records i have however when using relationship modifyQueryUsing option you are still left with the LIKE statement in query. Trying to use getSearchResultsUsing and relationship seems to just throw an error foreach() argument must be of type array|object, null given when trying to do a search. The relationship authors is BelongsToMany This code fails with the error: `Select::make('authors')...
Solution:
Seems i found the solution by looking at the source code of Select. When you provide an empty array to searchable it won't apply the automatic LIKE due to no columns defined. This Select won't apply the LIKE in final db query ...

Search options in SelectColumn

I have created a custom column that extends SelectColumn and I have added to the view the view of SelectColumn is there something I could do inside the blade so that I can have a search like functionality similar to the one there is in Select form component?

Livewire encountered corrupt data when trying to hydrate the [app.filament.resources.conference-reso

Im having this error, but in only appears on a few items, i already tried everything i can remember but i cant figure it why it works in most of the cases and others doesnt work. any one has any ideia?...
Solution:
Try casting it to a string. PHP doesn't handle large numbers like that

Default repeater items not working

Hello. I have an action button on a table to send an email. It opens a form to write the subject and type receivers. I need to fill in two different receivers by default, but it is not working. ```php Action::make('sendEmailToFactory')->label('')->modalDescription('send email to factory')...
Solution:
```php ->modalDescription('send email to factory') ->fillForm([ 'emails' => [ ['email' => '[email protected]'],...

Add a query with a join

I am trying to get some options. I have laptop assignment table which contains all laptops assigned to employee. We have two separate tables for laptop and employee. Now when i am adding a laptop assignment, i only want laptop who meets the following conditions to be showin the dropdown 1. Laptop should not have entry in laptop assignment...

fabricator plugin

Is it possible to make product blocks or product category blocks with fabricator?