| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | protected function filter(Builder $builder, Collection $filters) |
||
| 22 | { |
||
| 23 | $user = Auth::user(); |
||
| 24 | |||
| 25 | if (!$user->hasRole('admin')) { |
||
| 26 | $teamsIds = $user->teams->pluck('id')->toArray(); |
||
| 27 | |||
| 28 | $builder |
||
| 29 | ->leftJoin('membership', 'users.id', 'membership.user_id') |
||
| 30 | ->whereIn('team_id', $teamsIds); |
||
| 31 | |||
| 32 | if ($filters->has('name')) { |
||
| 33 | $builder->where('name', 'like', '%' . $filters->get('name') . '%'); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 48 |