Štakor
Štakor
FFilament
Created by Štakor on 9/11/2024 in #❓┊help
Repeater Item Loss in Filament Resource with SpatieMediaLibraryFileUpload
No description
2 replies
FFilament
Created by Štakor on 3/22/2023 in #❓┊help
Caching
How could i cache the data from getTableQuery and delete cache only on records change?
3 replies
FFilament
Created by Štakor on 3/16/2023 in #❓┊help
How do I speed up my list rendering?
12 replies
FFilament
Created by Štakor on 3/11/2023 in #❓┊help
Creating multiple select field, reading from and saving to string field in db, using enums?
I have created my select field: Select::make('velicinaStandard') ->multiple() ->options(StandardneVelicine::cases()) ->label('Veličina standard'), Options is using my enum: <?php namespace App\Enums; enum StandardneVelicine : string { case M = 'M'; case L = 'L'; case XL = 'XL'; case XXL = 'XXL'; } and regarding my velicinaStandard which is String with value like: M,L,XL I added get set to my MODEL (maybe this is the wrong place?): protected $casts = [ 'velicinaStandard' => 'array', ]; protected function velicinaStandard(): Attribute { return Attribute::make( get: fn ($value) => explode(',', $value), set: fn ($value) => implode(',', $value), ); } The options are there but my value from velicinaStandard is not showing up in selected options. What am I doing wrong?
4 replies
FFilament
Created by Štakor on 3/10/2023 in #❓┊help
Sorting question
I have default sorting on my table: ->defaultSort('created_at', 'desc') Two columns are sortable: TextColumn::make('title')->size('sm')->sortable(), TextColumn::make('created_at')->size('sm')->sortable()->dateTime('d.m.Y'), For each column, first two times sorting goes asc then desc and the up and down arrow lights up, but then third time sorting is off and the arrow is not lightened up. So third time sorting is off I guess and results are weird. Is this normal behaviour and can it be switched off so it goes asc desc only and change only if another sorting is clicked?
1 replies
FFilament
Created by Štakor on 3/9/2023 in #❓┊help
Hide table column if relationship does'nt exist?
TextColumn::make('velicina_bicikla.velicina') ->size('sm') ->description('veličina rama'), In my model: public function velicina_bicikla() { return $this->belongsToMany(VelicinaBicikla::class, 'bicikli_velicine_bicikla', 'biciklID', 'velicinaBiciklaID')->withTimestamps(); } How to hide this column (realtionship) only on records where it does not exist?
3 replies
FFilament
Created by Štakor on 3/8/2023 in #❓┊help
Multiple Resources with different table query but tables appearance is not different
In my list I overridden getTableQuery() based on path <?php namespace App\Filament\Resources\BiciklResource\Pages; use App\Filament\Resources\BiciklResource; use App\Filament\Resources\BiciklAktivniResource; use App\Filament\Resources\BiciklArhivaResource; use App\Models\Bicikl; use Filament\Pages\Actions; use Filament\Resources\Pages\ListRecords; use Illuminate\Database\Eloquent\Builder; class ListBicikls extends ListRecords { protected static string $resource = BiciklResource::class; protected function getActions(): array { return [ Actions\CreateAction::make(), ]; } protected function getTableRecordsPerPageSelectOptions(): array { return [12, 24, 48, 96, -1]; } protected function getTableQuery(): Builder { $path = request()->getPathInfo(); if ($path === '/admin/bicikli-aktivni') { return parent::getTableQuery()->where('pCena', null); } else if ( $path === '/admin/bicikli-arhiva' ) { return parent::getTableQuery()->whereNotNull('pCena'); } else { return parent::getTableQuery()->withoutGlobalScopes(); } } } But, even I changed tables in my Resources, they all look like one in BiciklResource. That's probably becuase of this line protected static string $resource = BiciklResource::class; Can I set this conditionally too or there is another way?
25 replies
FFilament
Created by Štakor on 3/6/2023 in #❓┊help
How do I change name and filename and preview before saving?
3 replies