sfneal /
users
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Sfneal\Users\Queries; |
||
| 4 | |||
| 5 | use Illuminate\Database\Eloquent\Collection; |
||
| 6 | use Sfneal\Queries\Query; |
||
| 7 | use Sfneal\Users\Builders\UserBuilder; |
||
| 8 | use Sfneal\Users\Models\User; |
||
| 9 | |||
| 10 | class NonTeamUsersQuery extends Query |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Retrieve a Query builder. |
||
| 14 | * |
||
| 15 | * @return UserBuilder |
||
| 16 | */ |
||
| 17 | protected function builder(): UserBuilder |
||
| 18 | { |
||
| 19 | return User::query()->withInactive(); |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Retrieve a Collection of User's who are NOT team members. |
||
| 24 | * |
||
| 25 | * @return Collection |
||
| 26 | */ |
||
| 27 | public function execute(): Collection |
||
| 28 | { |
||
| 29 | return $this->builder() |
||
| 30 | ->doesntHave('team') |
||
| 31 | ->orderBy('last_name', 'asc') |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 32 | ->orderBy('first_name', 'asc') |
||
| 33 | ->get(); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |