bearer
bearer
FFilament
Created by bearer on 4/22/2024 in #❓┊help
How to export table with enum column?
Hello! I have column that maps to some enum. When I try to use formatStateUsing:
ExportColumn::make('lang')
->formatStateUsing(function (LanguageCode $code) {
return $code->value;
}),
ExportColumn::make('lang')
->formatStateUsing(function (LanguageCode $code) {
return $code->value;
}),
I receive error
[2024-04-22 22:36:01] local.ERROR: Target [App\Enums\LanguageCode] is not instantiable while building [Laravel\Horizon\Console\WorkCommand, Filament\Actions\Exports\Jobs\ExportCsv]. {"userId":1,"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target [App\\Enums\\LanguageCode] is not instantiable while building [Laravel\\Horizon\\Console\\WorkCommand, Filament\\Actions\\Exports\\Jobs\\ExportCsv]
[2024-04-22 22:36:01] local.ERROR: Target [App\Enums\LanguageCode] is not instantiable while building [Laravel\Horizon\Console\WorkCommand, Filament\Actions\Exports\Jobs\ExportCsv]. {"userId":1,"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target [App\\Enums\\LanguageCode] is not instantiable while building [Laravel\\Horizon\\Console\\WorkCommand, Filament\\Actions\\Exports\\Jobs\\ExportCsv]
Is it possivle to fix it?
11 replies
FFilament
Created by bearer on 4/19/2024 in #❓┊help
Custom action triggers /livewire/update
This update tries to reload data in table (as I can see in debugbar). But this action should show modal window and refresh table only when user clicked "Confirm"
9 replies
FFilament
Created by bearer on 3/24/2024 in #❓┊help
Add separate `save and run` button to Edit form
How can I add new button to my Edit form - Save and Run - It will save current entity + run some additional logic?
2 replies
FFilament
Created by bearer on 2/23/2024 in #❓┊help
Sort by related hasOno of Many model field Bug
Hey guys. I have some problem with relations. Tried to sort by field which is accessible via ->hasMany()->one()->ofMany()->some_field For example I have 2 models - Channel and ChannelPost A Channel has many ChannelPost. A ChannelPost have views field with count of views. Now in Channel model I have this relations:
/**
* @return HasMany
*/
public function posts(): HasMany
{
return $this->hasMany(ChannelPost::class);
}

/**
* @return HasOne
*/
public function lastPost(): HasOne
{
return $this->posts()->one()->ofMany('post_id', 'max');
}
/**
* @return HasMany
*/
public function posts(): HasMany
{
return $this->hasMany(ChannelPost::class);
}

/**
* @return HasOne
*/
public function lastPost(): HasOne
{
return $this->posts()->one()->ofMany('post_id', 'max');
}
In Filament table I use Tables\Columns\TextColumn::make('lastPost.views') When I tried to sort by this field - it was sorted randomly. So I tried to find the problem and did some debugging. Here we are receiving an empty model for Post - https://github.com/filamentphp/tables/blob/3.x/src/Columns/Concerns/InteractsWithTableQuery.php#L144 And then https://github.com/filamentphp/support/blob/3.x/src/Concerns/HasCellState.php#L172 - here we are getting query with channel_id = null (because empty model has id = null) And because this it generates looong SQL order by clause: with channel_posts.channel_id is null ```
6 replies
FFilament
Created by bearer on 2/15/2024 in #❓┊help
How to make table live?
Is it possible to refresh table for example every 5 seconds?
4 replies
FFilament
Created by bearer on 2/14/2024 in #❓┊help
What parameters can I specify in disabled() closure of Action?
What parameters can I specify in disabled() closure of Action?
5 replies
FFilament
Created by bearer on 2/14/2024 in #❓┊help
Add Edit action on View page
Hello! How to add Edit button to View page of Resource?
4 replies
FFilament
Created by bearer on 2/8/2024 in #❓┊help
How to build form using some JSON structure?
For example I want to save my texts on 3 different languages and I want to store them in JSON { "en": {"text": "hello", "url": "https://ex.com"}, "es": {"text": "hola", "url": "https://xcx.com"}, "de": {"text": "hallo", "url": "https://de.com"} } How can I edit and display them in Filament. Builder seems like solution for some schema - but I need only to preserve some structure of my json, I want to have strictly 3 predefined languages.
4 replies