| Total Complexity | 14 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 35.7% |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 8 | class UserPolicy |
||
| 9 | { |
||
| 10 | use HandlesAuthorization; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Create a new policy instance. |
||
| 14 | * @param User $user |
||
| 15 | * @param $ability |
||
| 16 | * @return bool |
||
| 17 | */ |
||
| 18 | 7 | public function before(User $user, $ability) |
|
|
|
|||
| 19 | { |
||
| 20 | 7 | if ($user->isSuperAdmin()) { |
|
| 21 | 3 | return true; |
|
| 22 | } |
||
| 23 | 5 | return null; |
|
| 24 | } |
||
| 25 | |||
| 26 | // You can create a user if you are not a simple user |
||
| 27 | public function create(User $user) |
||
| 28 | { |
||
| 29 | if (!$user->isUser()) { |
||
| 30 | return true; |
||
| 31 | } |
||
| 32 | return false; |
||
| 33 | } |
||
| 34 | |||
| 35 | // You can store a user if you are not a simple user |
||
| 36 | public function store(User $user) |
||
| 37 | { |
||
| 38 | if (!$user->isUser()) { |
||
| 39 | return true; |
||
| 40 | } |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | |||
| 45 | public function delete(User $user, User $userModel) |
||
| 58 | } |
||
| 59 | |||
| 60 | 2 | public function edit(User $user, User $userModel) |
|
| 61 | { |
||
| 67 | } |
||
| 68 | |||
| 69 | 3 | public function update(User $user, User $userModel) |
|
| 77 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.