Filament

F

Filament

A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire

Join

admin user - trying to install filament 4 and create admin user

Hi - been wanting to have play with all the latest updates, have run into a silly issue - my users table I like to change so users always have a first name and last name for use later, when I try php artisan make:filament-user I’m unable to create a user obviously as it doesn’t match database values required, first name last name Tried vendor publish but not found what I need as yet - know I’ve done this before as dev work using filament I could add filament admin user after fresh migration and seeded users for testing all with first names and last names ? For production fine to set using domain but for dev work I want an admin user to access panels to build What have I missed ? Thanks in advance...
Solution:
use tinker php artisan tinker ```bash...

Exporting Image's + CSV/Excel using Exporter

HI All, I have a CMS Posts resource - having fields like name, title, description, image. I have created the exported for this - Now i can download the csv or excel but i also want to download the uploaded images too. Can you please let me know the best way to handle this - as i want to export both csv/excel data + images in a zip - and it should like follow the default queue system too....

Infolist - belongsToMany collection.count not rendering?

Hi all< I have 2 eloguent models with a many to many relations. I know the relationship is set up correctly in eloquent as a RepeatableEntry filed renders the individual members of the collection properly. I also want to output the count of the items in the collection with: TextEntry::make('declines.count')...

Validation Rules only on create

Is it possible to have validation rules only apply in the create step but not on later editing?
Solution:
use operation ```php TextInput::make('title') ->required(fn (string $operation) => $operation === 'create')...

Best practice for having multiple panels with single authentication

Hi there, After reading some issues on GitHub I was wondering what the current way is to have multiple panels but single authentication entry and redirect to same login page. I have 2 panels:...

Wizard with multiple (success) buttons

I have a wizard (inside a modal) for creating a resource. Is there a way to define more than one modalSubmitAction? What I’d like to achieve is to have, at the end of the process, two buttons: for example, “Create” and “Create another”. Or a "Create" and "Create and Send" Button....

->fill() does not work with SpatieMediaLibraryFileUpload

I am trying to implement a form where users can come back and edit their answers or upload new files but whatever I try to fill the SpatieMediaLibraryFileUpload with the data fails. If I provide uuid, path, url it doesn't give any error but also doesn't populate the field. If I were to give UploadedFile, Media or MediaCollection it gives an error with Filament\Forms\Components\SpatieMediaLibraryFileUpload::{closure:Filament\Forms\Components\SpatieMediaLibraryFileUpload::setUp():90}(): Argument #2 ($file) must be of type string, array given this error originates from closure used in$this->getUploadedFileUsing when the function setUp has been called. It's driving me insane. I have also tried to just use relationship but still the same problem! ...
Solution:
For any one having similar problems here is the solution 1. Define your model in the mount() function 2. Because lazy loading is disabled for Media model, add ->load('media') to the model you are fetching 3. Explicitly define ->model($this->yourModel) in the SpatieMediaLibraryFileUpload 4. Fill the field using the uuid of the media you're trying to use...
No description

v4 Page number pagination

Is the click on page number type of pagination still a thing on v4 (example pic I found from v3)? I can only get previous/next buttons to work. I tried ->paginationMode(PaginationMode::Default), but it's still just previous and next buttons. Maybe I'm missing something. 🤔...
Solution:
No description

RBAC in Multi Tenant system

Hi Everyone, I'm creating an Multi Tenant system and i want to implement RBAC - can you please help me to suggest what would be the best way to implement this - If you have any working example or a link to a github repo please help to share. Thanks...

Parent resources with nav

I understand that a resource can have a parent resource set, but am trying to get some behaviour and not sure if it's easily possible after digging a bit. Let's say we have an article that belongs to a category. Current behaviour...

EMERGENCY - before, using, and mutateRecordDataUsing doesn't work for EditAction

This is not working for a client that needs this done tomorrow. These methods work on the DeleteAction but not edit. ``` Tables\Actions\EditAction::make() ->mutateRecordDataUsing(function (array $data): array {...

Repeater limitation

I'm having an issue while adding a new feature to the repeater. I want to limit the delete functionality, since I don't need to delete the first repeater item but I do need to delete the others. I tried setting it up with deletable as mentioned in the documentation, but I couldn't achieve the desired result, because it takes the repeater in a general way This is my code: ``` Repeater::make('members')...
No description

V4 Layout help

I have the below code for a filament v4 layout, and I have attached the result for this layout in the screenshot. How can I extend sections so that the information section takes 4 columns and the image section takes 2 columns? Thanks for the help in advance.
Solution:
Flex doesn't support columns like that. Use a Grid instead ```php Grid::make(3) ->schema([...

Select with enum options bug in v4

I had a custom select extending Filament’s select, mainly to load enum options and set a default label (used repeatedly in the app). There’s also a cast so values are saved in the DB as the ordered days of the week. This worked fine in v3, but after upgrading I’m facing a bug: when editing a record, the already-selected days still appear as selectable options. If I pick them again, they duplicate and trigger a validation error on save. I suspect this might be related to my cast, but I’m not sure what changed. I attached the code...
No description

Condensed tables

I was working on a way to make more condensed tables because I have some 800 row tables (I know!). I found that adding this macro to my provider: ```Table::macro('condensed', function (string $class = 'fi-table-condensed'): Table { /** @var Table $this */...

Filament Table Outside of Panel

I am looking for an example of how to use a filament table outside of a panel. I have followed the example in the v4 docs, but the page I get is not formatted correctly. Looks like it is missing CSS or the JS to make it work.
Solution:
I think I figured out what what going on. The docs don't clearly state (in this contect) that you need to add @filamentstyles and @filamentjs

Add modal actions in panel header

I wanna add a dropdown to the panel header next to the user menu and then use the regular filament Actions (inside an ActionGroup). I know, that this is something similar to awcodes/filament-quick-create, but I need way more customization options. I could get the dropdown/ActionGroup already working: ```php...

CreateAction show duplicate notifications. How to disable default?

CreateAction::make() ->label('Add New') ->modalHeading('Add New') ->modalSubmitActionLabel('Save') ->modalWidth('6xl')...

RichEditor in v4 not working!

Hi, I have a RichEditor inside a modal from that is fired with an action. `Action::make('envia_factura') ->icon('heroicon-m-envelope') ->schema([...

Forbidden on temporaryUrl

Hello, In production, I am unable to display previews of images stored as private. The generated URL returns a 403 forbidden error. ...