Passed
Push — dev6 ( d87223...fbdc57 )
by Ron
18:58
created

TechTipCommentPolicy::delete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 2
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\TechTipComment;
6
use App\Models\User;
7
use App\Traits\AllowTrait;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class TechTipCommentPolicy
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\TechTipCommentPolicy: $role_id, $username, $allow
Loading history...
14
15
    public function manage(User $user)
16
    {
17
        return $this->checkPermission($user, 'Manage Tech Tips');
18
    }
19
20
    /**
21
     * Determine whether the user can view any models.
22
     *
23
     * @param  \App\Models\User  $user
24
     * @return \Illuminate\Auth\Access\Response|bool
25
     */
26
    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

26
    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...
27
    {
28
        //
29
    }
30
31
    /**
32
     * Determine whether the user can view the model.
33
     *
34
     * @param  \App\Models\User  $user
35
     * @param  \App\Models\TechTipComment  $techTipComment
36
     * @return \Illuminate\Auth\Access\Response|bool
37
     */
38
    public function view(User $user, TechTipComment $techTipComment)
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

38
    public function view(/** @scrutinizer ignore-unused */ User $user, TechTipComment $techTipComment)

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

38
    public function view(User $user, /** @scrutinizer ignore-unused */ TechTipComment $techTipComment)

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...
39
    {
40
        //
41
    }
42
43
    /**
44
     * Determine whether the user can create models.
45
     *
46
     * @param  \App\Models\User  $user
47
     * @return \Illuminate\Auth\Access\Response|bool
48
     */
49
    public function create(User $user)
50
    {
51
        return $this->checkPermission($user, 'Comment on Tech Tip');
52
    }
53
54
    /**
55
     * Determine whether the user can update the model.
56
     *
57
     * @param  \App\Models\User  $user
58
     * @param  \App\Models\TechTipComment  $techTipComment
59
     * @return \Illuminate\Auth\Access\Response|bool
60
     */
61
    public function update(User $user, TechTipComment $techTipComment)
62
    {
63
        return $user->user_id == $techTipComment->user_id;
64
    }
65
66
    /**
67
     * Determine whether the user can delete the model.
68
     *
69
     * @param  \App\Models\User  $user
70
     * @param  \App\Models\TechTipComment  $techTipComment
71
     * @return \Illuminate\Auth\Access\Response|bool
72
     */
73
    public function delete(User $user, TechTipComment $techTipComment)
74
    {
75
        return $user->user_id == $techTipComment->user_id || $this->checkPermission($user, 'Manage Tech Tips');
76
    }
77
78
    /**
79
     * Determine whether the user can restore the model.
80
     *
81
     * @param  \App\Models\User  $user
82
     * @param  \App\Models\TechTipComment  $techTipComment
83
     * @return \Illuminate\Auth\Access\Response|bool
84
     */
85
    public function restore(User $user, TechTipComment $techTipComment)
0 ignored issues
show
Unused Code introduced by
The parameter $techTipComment 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

85
    public function restore(User $user, /** @scrutinizer ignore-unused */ TechTipComment $techTipComment)

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

85
    public function restore(/** @scrutinizer ignore-unused */ User $user, TechTipComment $techTipComment)

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...
86
    {
87
        //
88
    }
89
90
    /**
91
     * Determine whether the user can permanently delete the model.
92
     *
93
     * @param  \App\Models\User  $user
94
     * @param  \App\Models\TechTipComment  $techTipComment
95
     * @return \Illuminate\Auth\Access\Response|bool
96
     */
97
    public function forceDelete(User $user, TechTipComment $techTipComment)
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

97
    public function forceDelete(/** @scrutinizer ignore-unused */ User $user, TechTipComment $techTipComment)

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

97
    public function forceDelete(User $user, /** @scrutinizer ignore-unused */ TechTipComment $techTipComment)

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...
98
    {
99
        //
100
    }
101
}
102