Passed
Push — dev6 ( 6ea9a3...2cfb0e )
by Ron
15:41
created

CustomerEquipmentPolicy::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
ccs 1
cts 1
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\CustomerEquipment;
6
use App\Models\User;
7
use App\Traits\AllowTrait;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class CustomerEquipmentPolicy
11
{
12
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\CustomerEquipmentPolicy: $role_id, $username, $allow
Loading history...
13
    use HandlesAuthorization;
14
15
16
    /**
17
     *  Determine if the user can create new equipment for the customer
18 4
     */
19
    public function create(User $user)
20 4
    {
21
        return $this->checkPermission($user, 'Add Customer Equipment');
22
    }
23
24
    /**
25
     *  Determine if the user can update the information for the given equipment
26 3
     */
27
    public function update(User $user)
28 3
    {
29
        return $this->checkPermission($user, 'Edit Customer Equipment');
30
    }
31
32
    /**
33
     *  Determine if the user can delete Customer Equipment
34 3
     */
35
    public function delete(User $user)
36 3
    {
37
        return $this->checkPermission($user, 'Delete Customer Equipment');
38
    }
39
40
    /**
41
     *  Determine if the user can restore deleted customer equipment
42 2
     */
43
    public function restore(User $user)
44 2
    {
45
        return $this->checkPermission($user, 'Manage Customers');
46
    }
47
48
    /**
49
     *  Determine if the user can completely delete customer equipment
50 2
     */
51
    public function forceDelete(User $user)
52 2
    {
53
        return $this->checkPermission($user, 'Manage Customers');
54
    }
55
}
56