Filters for users that have been removed

This commit is contained in:
David Bomba 2023-07-24 19:39:46 +10:00
parent b960a21201
commit 64e2ae0c57

View File

@ -69,6 +69,19 @@ class UserFilters extends QueryFilters
});
}
/**
* Filters users that have been removed from the
* company, but not deleted from the system.
*
* @return void
*/
public function hideRemovedUsers()
{
return $this->builder->whereHas('company_users', function ($q) {
$q->where('company_id', '=', auth()->user()->company()->id)->whereNull('deleted_at');
});
}
/**
* Overrides the base with() function as no company ID
* exists on the user table