HL
HL
FFilament
Created by HL on 4/5/2024 in #❓┊help
How can I conditionally disable a custom input field?
If I do this:
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<x-filament::input.wrapper :disabled=$isDisabled()>
<x-filament::input type="text" :disabled=$isDisabled() />
...
<x-dynamic-component :component="$getFieldWrapperView()" :field="$field">
<x-filament::input.wrapper :disabled=$isDisabled()>
<x-filament::input type="text" :disabled=$isDisabled() />
...
$isDisabled() always returns true and the field is disabled, either if I use:
CopyableTextInput::make('loginname')
->disable(),
CopyableTextInput::make('loginname')
->disable(),
or
CopyableTextInput::make('loginname')
CopyableTextInput::make('loginname')
4 replies
FFilament
Created by HL on 3/27/2024 in #❓┊help
In my table's getEloquentQuery() method should I eager load relations?
I know if I use the dot notation like TextColumn::make('game.id') it will automatically eager load, but if I do this:
TextColumn::make('service')
->description(fn (Model $record) => $record->details->nickname)
TextColumn::make('service')
->description(fn (Model $record) => $record->details->nickname)
with the details relation, should I eager load the details relation in the tables getEloquentQuery() method? Should this be a common practice?
5 replies
FFilament
Created by HL on 3/25/2024 in #❓┊help
In a table, is it possible to have a header label for the table actions column?
Every other column has a label, except the ones with the table actions.
5 replies
FFilament
Created by HL on 11/29/2023 in #❓┊help
Updating Dashboard filters doesn't update ChartWidget-s
The new v3.1.0 dashboard common filter function (https://filamentphp.com/docs/3.x/panels/dashboard#filtering-widget-data) only works on BaseWidget-s perfectly. If I use it on a ChartWidget, the chart itself doesn't update on UpdateFilters. I can see the values change in the livewire component, but the chartjs itself doesn't. If I refresh the full page, it updates correctly.
6 replies
FFilament
Created by HL on 11/29/2023 in #❓┊help
InteractsWithPageFilters doesn't refresh the Widget on filter change
My Dashboard.php and my Widget is all set up correctly to use the new v3.1.0 dashboard filter function. In my widget file with DebugBar I can see that $this->filters change correctly, but for some reason the widget itself doesn't refresh. Once I refresh the full page, it displays the correct filtered data. The docs say: "When the filters are updated, the widgets will be reloaded with the new data." I believe there is a bug with this part.
11 replies
FFilament
Created by HL on 10/24/2023 in #❓┊help
Modify SelectFilter query based on another SelectFilters value (Dependent Filters)
I have these 2 filters ( in my app:
SelectFilter::make('game')
->relationship('games', 'name'),

SelectFilter::make('server')
->relationship(
name: 'servers',
titleAttribute: 'abbrevation',
modifyQueryUsing: function (Builder $query) {
return $query->orderBy('servers.game', 'asc')->orderBy('servers.id', 'asc');
}
),
SelectFilter::make('game')
->relationship('games', 'name'),

SelectFilter::make('server')
->relationship(
name: 'servers',
titleAttribute: 'abbrevation',
modifyQueryUsing: function (Builder $query) {
return $query->orderBy('servers.game', 'asc')->orderBy('servers.id', 'asc');
}
),
I want to make the 2nd filter so, that it only queries the servers, which are selected by the first selectFilter, or otherwise show all. I can do that with custom filters, but is there some out of the box solution for this?
14 replies
FFilament
Created by HL on 8/31/2023 in #❓┊help
->recordUrl global setting not working
For some reason, if I use ->recordUrl(false) in the AdminPanelProvider, it doesn't work, but it works separately in the Resource.
return $panel
->bootUsing(function () {
Table::configureUsing(function (Table $table): void {
$table
->recordUrl(false)
->striped();
});
})
return $panel
->bootUsing(function () {
Table::configureUsing(function (Table $table): void {
$table
->recordUrl(false)
->striped();
});
})
All my columns are striped so that part is working, and again ->recordUrl(false) works if I put it in the resource's table function, so I'm not sure what I'm missing.
12 replies
FFilament
Created by HL on 8/16/2023 in #❓┊help
Set dark mode on by default
Is there a way to set the theme localStorage variable to 'dark' by default for everyone, instead of 'system'? My website has a dark color, not switchable. If someone has light mode in the system, and tries to log in, it would blind them permanently 😄 Of course if it's not possible, I'll edit the base bg colors in css to dark ones, but would be nice to still have the light mode option, although not as the default.
13 replies
FFilament
Created by HL on 8/15/2023 in #❓┊help
Filter value=null error after refreshing page
I have a simple filter in my Resource's table:
return $table
...
->filters([
SelectFilter::make('service')
->placeholder('All')
->options([
1 => 'Account',
2 => 'Custom Leveling',
])
->native(false),
])
...
return $table
...
->filters([
SelectFilter::make('service')
->placeholder('All')
->options([
1 => 'Account',
2 => 'Custom Leveling',
])
->native(false),
])
...
I open the resource table from the url: http://127.0.0.1:8000/admin/all-orders This sql query runs:
select * from `all_orders` order by `id` desc limit 10 offset 0
select * from `all_orders` order by `id` desc limit 10 offset 0
All good. Now I set the filter once to something http://127.0.0.1:8000/admin/all-orders?tableFilters[service][value]=1 I refresh the page, still all good Than delete the filter, and get to this url: http://127.0.0.1:8000/admin/all-orders?tableFilters[service][value]=null I refresh, and no result are shown and this sql query is run:
select count(*) as aggregate from `all_orders` where (`service` = 'null')
select count(*) as aggregate from `all_orders` where (`service` = 'null')
The service is always an integer, can't be null. Is it the intended way for the url query to switch to null, in case I delete the filter? I noticed, that this isn't the case when I never refresh the site, that is what's causing the problem.
9 replies
FFilament
Created by HL on 8/14/2023 in #❓┊help
->relationship() with hasOneThrough() relation doesn't work anymore
Hi guys, in my Account model I have this relation:
public function games()
{
return $this->hasOneThrough(
Game::class,
SmurfType::class,
'id', // Foreign key on SmurfType table
'id', // Foreign key on Game table
'smurftype', // Local key on Account table
'game' // Local key on SmurfType table
);
}
public function games()
{
return $this->hasOneThrough(
Game::class,
SmurfType::class,
'id', // Foreign key on SmurfType table
'id', // Foreign key on Game table
'smurftype', // Local key on Account table
'game' // Local key on SmurfType table
);
}
In v2 I used this and it worked perfectly:
SelectFilter::make('game')
->relationship('games', 'name'),
SelectFilter::make('game')
->relationship('games', 'name'),
Now it gives me this error: Filament\Forms\Components\Select::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\BelongsToMany|Znck\Eloquent\Relations\BelongsToThrough|null, Illuminate\Database\Eloquent\Relations\HasOneThrough returned Is there a way to solve this without manually giving options and a query method myself, like it used to be?
5 replies
FFilament
Created by HL on 3/29/2023 in #❓┊help
Set multiple columns in protected function getDefaultTableSortColumn()
Is it possible to order a table by multiple columns, just like:
$query->orderBy('col1', 'asc')->orderBy->('col2', 'asc')
$query->orderBy('col1', 'asc')->orderBy->('col2', 'asc')
?
6 replies
FFilament
Created by HL on 3/4/2023 in #❓┊help
Action buttons dissapeared
4 replies