| Total Complexity | 6 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class CustomerPolicy |
||
| 12 | { |
||
| 13 | use HandlesAuthorization; |
||
| 14 | use AllowTrait; |
||
|
1 ignored issue
–
show
|
|||
| 15 | |||
| 16 | /* |
||
| 17 | * Manage customers determines if they can deactivate and recover customers |
||
| 18 | */ |
||
| 19 | public function manage(User $user) |
||
| 20 | { |
||
| 21 | return $this->checkPermission($user, 'Manage Customers'); |
||
| 22 | } |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Determine whether the user can create new customers |
||
| 26 | */ |
||
| 27 | public function create(User $user) |
||
| 28 | { |
||
| 29 | return $this->checkPermission($user, 'Add Customer'); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Determine if the user can update the customers basic details |
||
| 34 | */ |
||
| 35 | public function update(User $user, Customer $customer) |
||
| 36 | { |
||
| 37 | return $this->checkPermission($user, 'Update Customer'); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Determine if the user can deactivate the customer |
||
| 42 | */ |
||
| 43 | public function delete(User $user, Customer $customer) |
||
| 44 | { |
||
| 45 | return $this->checkPermission($user, 'Deactivate Customer'); |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Determine if the user can re-activate a deactivated customer |
||
| 50 | */ |
||
| 51 | public function restore(User $user, Customer $customer) |
||
| 52 | { |
||
| 53 | return $this->checkPermission($user, 'Manage Customers'); |
||
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * Determine if the user can permanently delete the customer and all associated information |
||
| 58 | */ |
||
| 59 | public function forceDelete(User $user, Customer $customer) |
||
| 62 | } |
||
| 63 | } |
||
| 64 |