Rus
Rus
FFilament
Created by Rus on 10/26/2023 in #❓┊help
How to control order of images in spatie media library field while saving?
I have a SpatieMediaLibraryFileUpload field for images in my Filament resource. It's multiple. When I choose or drag&drop files there they have some order in preview. But after I save them their order is changed. But it's a bit confusing thing - before you save them, you can't be sure what order you'll get. What we could do to be sure that order in the preview will be saved? Thanks! My field looks like that now: 'images' => SpatieMediaLibraryFileUpload::make('images') ->label(__('general.images.label')) ->collection('images') ->columnSpan(2) ->imagePreviewHeight('250') ->panelLayout('grid') ->image() ->multiple() ->enableOpen() ->enableReordering() ->uploadProgressIndicatorPosition('left') ->disk(app()->environment('local') ? 'public' : config('media-library.disk_name')) ->visibility(function () { return (config('media-library.disk_name') === 's3') && config('someproject.store_images_private', true) ? 'private' : 'public'; }) ->reactive(),
2 replies
FFilament
Created by Rus on 8/23/2023 in #❓┊help
v2 -> v3 What to use instead of InteractsWithRelationship for bulk action?
Hi, all! I used the trait Filament\Tables\Actions\Concerns\InteractsWithRelationship for my AttachBulkAction in v2, but in v3 we don't have this trait. What I should use instead of it?
2 replies
FFilament
Created by Rus on 8/16/2023 in #❓┊help
How to create really unique Repeater
Hi, all! We have repeater with some field, let's say 'name'. This name should be unique. So if we add several items of repeater and try to fill name field in some of them with non unique value - it shouldn't pass validation. What s the best way to do something like that?
6 replies
FFilament
Created by Rus on 8/7/2023 in #❓┊help
How to use table inside a form?
I want to use table with checkboxes, pagination and filters (as we use it on list page) inside a form on edit page. Is that possible?
9 replies
FFilament
Created by Rus on 3/27/2023 in #❓┊help
Default value and reactive fields
Hi there! Guys, what's the problem with the default value of the second select 'method'? I know that if the string if (!$action) return []; is erased, everything works. So the problem is in the empty array that we return when action is not selected. But even after selecting the 'action' is performed, the default value for 'method' is not stated, it is still null and we see a placeholder here. Action is reactive. What I'm doing wrong? Thanks! Forms\Components\Select::make('action') ->options(function (Closure $get) { return Event::getAvailableActionsForSelect($get('trigger_type')); }) ->reactive(), Forms\Components\Card::make() ->schema(function (Closure $get) { $action = $get('action'); if (!$action) return []; return [ Forms\Components\Select::make('method') ->options([ 'get' => 'GET', 'POST' => 'POST', 'PUT' => 'PUT', 'PATCH' => 'PATCH', 'DELETE' => 'DELETE', ]) ->default('get') ] })
6 replies