Filament

F

Filament

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

Join

Issue with relationmanager on complicated relation (bug?)

Hi, I have a more complicated relation on my orders table. I want to retrieve all invoice lines which are connected to orders, orders.products or orders.products.attachments. This way I can display all invoice lines related to the order without navigating to the underlying resources. The relationship is looking as follows: ```php public function invoiceLines() {...
No description

Custom Modal form closes as soon as I click on it.

What could be the reason why the modal form I made as a custom with my codes I shot as a video closes automatically when I switch to the side tab?

How to import Alpine in custom script

I would like to extract an Alpine.data() component to a separate js file located in resources/js/filament/app.js. ``` FilamentAsset::register([ Js::make('custom-script', resource_path('/js/filament/admin/app.js')),...
Solution:
use ```js document.addEventListener('alpine:init', () => { //your code.. })...
No description

Possible to manually bundle Filament's JavaScript assets instead of relying on @filamentScripts ?

We're working on a project where we need to support older mobile browsers (e.g iOS Safari 13) which don't support some modern JavaScript features (e.g null coalesce operator). How we're handling this with other assets is by building them with Vite and targeting an older version of ES via @vitejs/plugin-legacy, however Filament's JS assets are precompiled (targeting ES2020) and included directly. We're hoping there's a way to prevent Filament from including these precompiled assets so we can include them in our own asset pipeline and target our desired version of JavaScript, but this doesn't seem to be mentioned in the docs. Ideally we'd like to do it in the same way Livewire allows us to: https://livewire.laravel.com/docs/installation#manually-bundling-livewire-and-alpine ...

getTabs() and limiting CreateAction options

Is it possible to determine which getTabs() option is enabled when launching an Action ? I want to split a table by getTabs() to various sections, and would like the CreateAction Header to respect that 'filter'...
Solution:
$livewire->$livewire->activeTab

Modify size on modal view of resource

Hi I'm trying to find a way to make a Resource (modal) view appear larger than normal and center it on the screen. Is possible? Where doc about this? ...
Solution:
actually, you can change the modal width in the ViewAction, like ```php Tables\Actions\ViewAction::make() ->modalWidth(MaxWidth::SevenExtraLarge)...
No description

Table filter dropdown closes when custom filter (flatpickr) is active

Can't seem to figure out why the filter dropdown closes when I click on next/prev button on the flatpickr instance. date-range-picker.blade.php snippet as below: ```js <x-dynamic-component :component="$getFieldWrapperView()"...
No description

Call Model on afterValidate

How could I trigger a modal on a afterValidate() hook of User Registration. I would like to do this for OTP Verification

Bulk actions which is only visible when 2 rows are selected

I'm trying to make a bulk action appear only when 2 table rows are selected. I'm using the visible function to try and achieve this: ->visible(fn ($livewire) => $livewire->selectedTableRecords == 2) But this livewire array always seems to be empty no matter how many rows are selected?...

Add a Create and edit button

In a RelationManager: How can I use custom or CreateAction to Create the record and keep editing and not Close the modal...
Solution:
Turns out it is easy once I know to add this to my CreateAction

Struggling with SelectFilter with relationship() and distinct status (Enum)

Hi guys ! I want to make a filter or the abacus_status in my users table but this status is in another table user_details, linked to the users via the details() relationship. What is wrong in my code ? ERROR : Object of class App\Enums\Users\AbacusStatusEnum could not be converted to string ```php...

Add Action to Select modal create and update

I have a form with a Template entity and a Select field for the Sender entity which is a table with SMTP data for sending emails. The Sender field is defined like this: ```php Select::make('sender')...
Solution:
maybe you could use a form action in the getFormSchema, like: ```php use Filament\Forms\Components\Actions; ...

Register colors

I register new colors on Panel with this code: ```public function boot(): void { FilamentColor::register([...

Advanced Tables Filter Not Adding Filter

What I'm trying to do: Hello, this is a very simple table, I'm trying to add an Advanced Table Filter for "created_at". Thank you in advance, maybe I'm doing something wrong, maybe something is wrong with the package? What I did: I added a simple filter to the table...
Solution:
This was already discussed offline earlier today, but since I’m just now seeing this was posted here too I’ll respond here too: The issue you are having is the DateFilter is what I call a “columnFilter” this means you need to use the ->includeColumns() method on your filter. So to break it down:...

livewire with table inside form: now the form is not saving

Hi! I have a livewire compoenent that starting from a recor di displaying a table with some options that are selectable: ```php class ListExhibitions extends Component implements HasForms, HasTable {...

Image Postprocessing

Folks, how do I get the path of an uploaded image? (I want to edit this image by sending it to an API, then replace it) ```php FileUpload::make('image') ->afterStateUpdated(function ($state) { $path = $state->getPath();...

Header Action filter not applying to Table Widget

Hello, I have created a custom page which extends the default Filament\Pages\Page and added a Header Action Filter Action filter like hoping to apply the filter on a custom table widget I have created. This setup works pretty well with chart widgets but this doesn't seem to be the case for table widgets. This is the Page class: ```...

Custom resource route with extra parameters

Hello, I'd like to make this work: ```php...

Adding a record count alongside a navigation link

Hi could you point me to the feature that enables the display of the number of orders (in this case 193) shown in the attached?
I can see it's related to the number of "new" orders - just need to understand how the number gets put there. I have had a look at the source code on github and see the navigation title definition here...
Solution:
public static function getNavigationBadge(): ?string
{
return 420;
}
public static function getNavigationBadge(): ?string
{
return 420;
}
...
No description