FilamentF
Filament2y ago
emil

Soft-deleted relations

Found other posts before but no answers.

Works when campaign is soft-deleted:
TextColumn::make('campaign.user.name')

However, this doesn't work:
->url(fn ($record) => UserResource::getUrl('edit', [$record->campaign->user]))

modifyQueryUsing is eager loading it - however that doesn't seem to affect $record.

Query being run:
select * from campaigns where campaigns.id in (5) and campaigns.deleted_at is null

Modify query on the table:

->modifyQueryUsing(function ($query) {
return $query->with(['campaign' => function ($query) {
$query->withTrashed()->with(['user']);
}]);
})
Was this page helpful?