Passed
Push — dev6 ( 85d655...fe3508 )
by Ron
18:08
created

EquipmentCategoryPolicy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 7
eloc 6
c 2
b 0
f 0
dl 0
loc 87
rs 10
ccs 14
cts 14
cp 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A restore() 0 2 1
A view() 0 2 1
A forceDelete() 0 2 1
A viewAny() 0 2 1
A delete() 0 4 1
A create() 0 4 1
A update() 0 4 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\EquipmentCategory;
6
use App\Models\User;
7
use App\Traits\AllowTrait;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class EquipmentCategoryPolicy
11
{
12
    use HandlesAuthorization;
13
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\EquipmentCategoryPolicy: $role_id, $username, $allow
Loading history...
14
15
    /**
16
     * Determine whether the user can view any models.
17
     *
18 13
     * @param  \App\Models\User  $user
19
     * @return \Illuminate\Auth\Access\Response|bool
20 13
     */
21
    public function viewAny(User $user)
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

21
    public function viewAny(/** @scrutinizer ignore-unused */ User $user)

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...
22 13
    {
23 13
        //
24
    }
25 13
26
    /**
27 13
     * Determine whether the user can view the model.
28
     *
29 7
     * @param  \App\Models\User  $user
30
     * @param  \App\Models\EquipmentCategory  $equipmentCategory
31 6
     * @return \Illuminate\Auth\Access\Response|bool
32
     */
33
    public function view(User $user, EquipmentCategory $equipmentCategory)
0 ignored issues
show
Unused Code introduced by
The parameter $equipmentCategory 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

33
    public function view(User $user, /** @scrutinizer ignore-unused */ EquipmentCategory $equipmentCategory)

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...
Unused Code introduced by
The parameter $user 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

33
    public function view(/** @scrutinizer ignore-unused */ User $user, EquipmentCategory $equipmentCategory)

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...
34
    {
35
        //
36
    }
37
38
    /**
39 4
     * Determine whether the user can create models.
40
     *
41 4
     * @param  \App\Models\User  $user
42
     * @return \Illuminate\Auth\Access\Response|bool
43
     */
44
    public function create(User $user)
45
    {
46
        //
47
        return $this->checkPermission($user, 'Manage Equipment');
48
    }
49
50
    /**
51 1
     * Determine whether the user can update the model.
52
     *
53 1
     * @param  \App\Models\User  $user
54
     * @param  \App\Models\EquipmentCategory  $equipmentCategory
55
     * @return \Illuminate\Auth\Access\Response|bool
56
     */
57
    public function update(User $user, EquipmentCategory $equipmentCategory)
0 ignored issues
show
Unused Code introduced by
The parameter $equipmentCategory 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

57
    public function update(User $user, /** @scrutinizer ignore-unused */ EquipmentCategory $equipmentCategory)

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...
58
    {
59
        //
60
        return $this->checkPermission($user, 'Manage Equipment');
61
    }
62
63 1
    /**
64
     * Determine whether the user can delete the model.
65 1
     *
66
     * @param  \App\Models\User  $user
67
     * @param  \App\Models\EquipmentCategory  $equipmentCategory
68
     * @return \Illuminate\Auth\Access\Response|bool
69
     */
70
    public function delete(User $user, EquipmentCategory $equipmentCategory)
0 ignored issues
show
Unused Code introduced by
The parameter $equipmentCategory 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

70
    public function delete(User $user, /** @scrutinizer ignore-unused */ EquipmentCategory $equipmentCategory)

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...
71
    {
72
        //
73
        return $this->checkPermission($user, 'Manage Equipment');
74
    }
75
76
    /**
77
     * Determine whether the user can restore the model.
78
     *
79
     * @param  \App\Models\User  $user
80
     * @param  \App\Models\EquipmentCategory  $equipmentCategory
81
     * @return \Illuminate\Auth\Access\Response|bool
82
     */
83
    public function restore(User $user, EquipmentCategory $equipmentCategory)
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

83
    public function restore(/** @scrutinizer ignore-unused */ User $user, EquipmentCategory $equipmentCategory)

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...
Unused Code introduced by
The parameter $equipmentCategory 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

83
    public function restore(User $user, /** @scrutinizer ignore-unused */ EquipmentCategory $equipmentCategory)

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...
84
    {
85
        //
86
    }
87
88
    /**
89
     * Determine whether the user can permanently delete the model.
90
     *
91
     * @param  \App\Models\User  $user
92
     * @param  \App\Models\EquipmentCategory  $equipmentCategory
93
     * @return \Illuminate\Auth\Access\Response|bool
94
     */
95
    public function forceDelete(User $user, EquipmentCategory $equipmentCategory)
0 ignored issues
show
Unused Code introduced by
The parameter $user 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

95
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, EquipmentCategory $equipmentCategory)

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...
Unused Code introduced by
The parameter $equipmentCategory 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

95
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ EquipmentCategory $equipmentCategory)

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...
96
    {
97
        //
98
    }
99
}
100