How to hide null relationships on table

I have a Table showing Applications for Vacancies (Vacancies HasMany Applications and Applications BelongsTo a Vacancy). When Vacancies are deleted, any Applications have their relation set to
null
  • this is so the person posting a Vacancy can’t delete an Application by another user.
want to try two things:

First idea, how do I filter Applications will a
null
Vacancy relation? Here’s my current code for show all Applications and their Vacancy
// ApplicationResource
$table
->columns([
    Tables\Columns\TextColumn::make('title')
        ->searchable(),
    Tables\Columns\TextColumn::make('vacancy.title')
        ->url(fn (Application $application): string => VacancyResource::getUrl('edit', ['record' => $application->vacancy_id])),
    Tables\Columns\TextColumn::make('created_at')
        ->label('Received')
        ->dateTime(),
])
...


Second idea - how can I display ‘Deleted vacancy’ if the relationship is
null
Was this page helpful?