withTrashed eagerload doesnt work in table columns
So i have this
public static function getEloquentQuery()
{
return parent::getEloquentQuery()
->with('relation', fn ($query) => $query->withTrashed());
}
8 Replies
it doesnt work
Is this in admin or in tables seperately?
Why are you applying trashed in the Eloquent query? Add a trashed filter and apply it by default so people can filter trashed and non-trashed etc
Filament
Filters - Table Builder - Filament
The elegant TALL stack table builder for Laravel artisans.
add withTrashed() on to the relationship definition itself
this is for a relationship, not the main table query
Ahh I missed that
isn't my code what you were referring to?
the same code works if I use it for non table (e.g dumping)
should not be related with the
applyEagerLoads
method right?
Worth to note, that I also have
does this have any association with withTrashed not working?no, the relationship definition method on your model
not the table query
noted...
do you know why the table query doesnt work while the relationship definition does?
I did an experiment, using these
does work with what you propose
the relationship definition method on your model
however, if experiment with these: