Passed
Push — dev6 ( 65456c...37607e )
by Ron
19:01
created

TechTipPolicy   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

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

6 Methods

Rating   Name   Duplication   Size   Complexity  
A update() 0 3 1
A restore() 0 2 1
A create() 0 3 1
A delete() 0 3 1
A manage() 0 3 1
A forceDelete() 0 2 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\TechTip;
7
use App\Traits\AllowTrait;
8
9
use Illuminate\Auth\Access\HandlesAuthorization;
10
11
class TechTipPolicy
12
{
13
    use AllowTrait;
1 ignored issue
show
introduced by
The trait App\Traits\AllowTrait requires some properties which are not provided by App\Policies\TechTipPolicy: $role_id, $allow
Loading history...
14
    use HandlesAuthorization;
15
16
    /*
17
    *   Determine if a user can Manage Tech Tips
18
    */
19
    public function manage(User $user)
20
    {
21
        return $this->checkPermission($user, 'Manage Tech Tips');
22
    }
23
24
    /**
25
     *  Determine if a user can add a new Tech Tip
26
     */
27
    public function create(User $user)
28
    {
29
        return $this->checkPermission($user, 'Add Tech Tip');
30
    }
31
32
    /**
33
     *  Determine if a user can edit an existing Tech Tip
34
     */
35
    public function update(User $user)
36
    {
37
        return $this->checkPermission($user, 'Edit Tech Tip');
38
    }
39
40
    /**
41
     *  Determine if a user can soft delete a Tech Tip
42
     */
43
    public function delete(User $user)
44
    {
45
        return $this->checkPermission($user, 'Delete Tech Tip');
46
    }
47
48
    /**
49
     * Determine whether the user can restore the model.
50
     *
51
     * @param  \App\Models\User  $user
52
     * @param  \App\Models\TechTip  $techTip
53
     * @return mixed
54
     */
55
    public function restore(User $user, TechTip $techTip)
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

55
    public function restore(/** @scrutinizer ignore-unused */ User $user, TechTip $techTip)

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 $techTip 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

55
    public function restore(User $user, /** @scrutinizer ignore-unused */ TechTip $techTip)

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...
56
    {
57
        //
58
    }
59
60
    /**
61
     * Determine whether the user can permanently delete the model.
62
     *
63
     * @param  \App\Models\User  $user
64
     * @param  \App\Models\TechTip  $techTip
65
     * @return mixed
66
     */
67
    public function forceDelete(User $user, TechTip $techTip)
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

67
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, TechTip $techTip)

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 $techTip 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

67
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ TechTip $techTip)

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...
68
    {
69
        //
70
    }
71
}
72