| Total Complexity | 13 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class CandidatePolicy |
||
| 10 | { |
||
| 11 | use HandlesAuthorization; |
||
| 12 | |||
| 13 | public function view(User $user, Candidate $candidate) |
||
| 14 | { |
||
| 15 | if ($user->can('read all recruitments')) { |
||
| 16 | return true; |
||
| 17 | } |
||
| 18 | |||
| 19 | if ($user->grantedRecruitments->contains($candidate->recruitment->id)) { |
||
| 20 | return true; |
||
| 21 | } |
||
| 22 | |||
| 23 | return false; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function delete(User $user, Candidate $candidate) |
||
|
|
|||
| 27 | { |
||
| 28 | if ($user->can('update any recruitment')) { |
||
| 29 | return true; |
||
| 30 | } |
||
| 31 | |||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | public function create(User $user) |
||
| 36 | { |
||
| 37 | if ($user->can('create candidates')) { |
||
| 38 | return true; |
||
| 39 | } |
||
| 40 | |||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | public function update(User $user, Candidate $candidate) |
||
| 45 | { |
||
| 46 | if ($user->can('update any recruitment')) { |
||
| 47 | return true; |
||
| 48 | } |
||
| 49 | |||
| 50 | if ($user->grantedRecruitments->contains($candidate->recruitment->id)) { |
||
| 51 | return true; |
||
| 52 | } |
||
| 53 | |||
| 54 | return false; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function changeStage(User $user) |
||
| 69 | } |
||
| 70 | } |
||
| 71 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.