Test Failed
Push — dev6 ( ed7d16...d1c8a2 )
by Ron
19:11
created

CustomerEquipmentPolicy   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
c 1
b 0
f 0
dl 0
loc 51
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A forceDelete() 0 3 1
A edit() 0 3 1
A restore() 0 3 1
A update() 0 3 1
A create() 0 3 1
A delete() 0 3 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Traits\AllowTrait;
6
7
use App\Models\User;
8
use App\Models\CustomerEquipment;
9
10
use Illuminate\Auth\Access\HandlesAuthorization;
11
12
class CustomerEquipmentPolicy
13
{
14
    use HandlesAuthorization;
15
    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, $allow
Loading history...
16
17
    /**
18
     *  Determine if the user can create new equipment for the customer
19
     */
20
    public function create(User $user)
21
    {
22
        return $this->checkPermission($user, 'Add Customer Equipment');
23
    }
24
25
    /**
26
     *  Determine if the user can update the information for the given equipment
27
     */
28
    public function edit(User $user)
29
    {
30
        return $this->checkPermission($user, 'Edit Customer Equipment');
31
    }
32
33
    /**
34
     *  Determine if the user can update the information for the given equipment
35
     */
36
    public function update(User $user, CustomerEquipment $customerEquipment)
0 ignored issues
show
Unused Code introduced by
The parameter $customerEquipment is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

36
    public function update(User $user, /** @scrutinizer ignore-unused */ CustomerEquipment $customerEquipment)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
37
    {
38
        return $this->checkPermission($user, 'Edit Customer Equipment');
39
    }
40
41
    /**
42
     *  Determine if the user can delete Customer Equipment
43
     */
44
    public function delete(User $user, CustomerEquipment $customerEquipment)
0 ignored issues
show
Unused Code introduced by
The parameter $customerEquipment is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

44
    public function delete(User $user, /** @scrutinizer ignore-unused */ CustomerEquipment $customerEquipment)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
    {
46
        return $this->checkPermission($user, 'Delete Customer Equipment');
47
    }
48
49
    /**
50
     *  Determine if the user can restore deleted customer equipment
51
     */
52
    public function restore(User $user, CustomerEquipment $customerEquipment)
0 ignored issues
show
Unused Code introduced by
The parameter $customerEquipment is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

52
    public function restore(User $user, /** @scrutinizer ignore-unused */ CustomerEquipment $customerEquipment)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
    {
54
        return $this->checkPermission($user, 'Delete Customer Equipment');
55
    }
56
57
    /**
58
     *  Determine if the user can completely delete customer equipment
59
     */
60
    public function forceDelete(User $user, CustomerEquipment $customerEquipment)
0 ignored issues
show
Unused Code introduced by
The parameter $customerEquipment is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ CustomerEquipment $customerEquipment)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
61
    {
62
        return $this->checkPermission($user, 'Delete Customer');
63
    }
64
}
65