CustomerPolicy::manage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Traits\AllowTrait;
7
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class CustomerPolicy
11
{
12
    use AllowTrait;
13
    use HandlesAuthorization;
14
15
    /*
16
    * Manage customers determines if they can deactivate and recover customers
17
    */
18
    public function manage(User $user)
19
    {
20
        return $this->checkPermission($user, 'Manage Customers');
21
    }
22
23
    /**
24
     * Determine whether the user can create new customers
25
     */
26
    public function create(User $user)
27
    {
28
        return $this->checkPermission($user, 'Add Customer');
29
    }
30
31
    /**
32
     * Determine whether the user can update the customer
33
     */
34
    public function update(User $user)
35
    {
36
        return $this->checkPermission($user, 'Update Customer');
37
    }
38
39
    /**
40
     * Determine whether the user can delete the customer
41
     */
42
    public function delete(User $user)
43
    {
44
        return $this->checkPermission($user, 'Deactivate Customer');
45
    }
46
47
    /**
48
     * Determine whether the user can restore the customer
49
     */
50
    public function restore(User $user)
51
    {
52
        return $this->checkPermission($user, 'Deactivate Customer');
53
    }
54
55
    /**
56
     * Determine whether the user can permanently delete the customer
57
     */
58
    public function forceDelete(User $user)
59
    {
60
        return $this->checkPermission($user, 'Delete Customer');
61
    }
62
}
63