mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Exclude users from list
This commit is contained in:
parent
1e96eeecb0
commit
1a44955f0f
@ -88,4 +88,25 @@ class UserFilters extends QueryFilters
|
||||
->orderByRaw("{$this->with_property} = ? DESC", [$value])
|
||||
->where('account_id', auth()->user()->account_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude a list of user_ids, can pass multiple
|
||||
* user IDs by separating them with a comma.
|
||||
*
|
||||
* @param string $user_id
|
||||
* @return Builder
|
||||
*/
|
||||
public function without(string $user_id = ''): Builder
|
||||
{
|
||||
if (strlen($user_id) == 0) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
$user_array = $this->transformKeys(explode(',', $user_id));
|
||||
|
||||
return $this->builder->where(function ($query) use ($user_array) {
|
||||
$query->whereNotIn('id', $user_array)
|
||||
->where('account_id', auth()->user()->account_id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user