I have a query to get all soft delete tournaments:
$tournaments = Tournament::onlyTrashed();
Thing is Tournament model has a FK owner_id.
Sometimes, owner has been soft deleted, so when I try to get $tournament->owner->id, I get an exception.
How to get All trashed Tournament which user is not soft deleted in Eloquent???
Is there a more elegant (Eloquent) solution that :
$tournaments = Tournament::onlyTrashed()
->join('users', 'users.id', '=', 'tournament.user_id')
->where('users.deleted_at', '=', null)
->select('tournament.*')
->get();
Tx!