Passed
Push — dev6 ( e5f62e...b9a96f )
by Ron
20:15
created

TechTipCommentPolicy::manage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
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, $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 create models.
22
     *
23
     * @param  \App\Models\User  $user
24
     * @return mixed
25
     */
26
    public function create(User $user)
27
    {
28
        return $this->checkPermission($user, 'Comment on Tech Tip');
29
    }
30
31
    /**
32
     * Determine whether the user can update the model.
33
     *
34
     * @param  \App\Models\User  $user
35
     * @param  \App\Models\TechTipComment  $techTipComment
36
     * @return mixed
37
     */
38
    public function update(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 update(/** @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 update(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 delete the model.
45
     *
46
     * @param  \App\Models\User  $user
47
     * @param  \App\Models\TechTipComment  $techTipComment
48
     * @return mixed
49
     */
50
    public function delete(User $user, TechTipComment $techTipComment)
51
    {
52
        if($this->checkPermission($user, 'Manage Tech Tips'))
53
        {
54
            return true;
55
        }
56
57
        return $user->user_id === $techTipComment->user_id;
58
    }
59
60
    /**
61
     * Determine whether the user can restore the model.
62
     *
63
     * @param  \App\Models\User  $user
64
     * @param  \App\Models\TechTipComment  $techTipComment
65
     * @return mixed
66
     */
67
    public function restore(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

67
    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...
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

67
    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...
68
    {
69
        //
70
    }
71
72
    /**
73
     * Determine whether the user can permanently delete the model.
74
     *
75
     * @param  \App\Models\User  $user
76
     * @param  \App\Models\TechTipComment  $techTipComment
77
     * @return mixed
78
     */
79
    public function forceDelete(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

79
    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...
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

79
    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...
80
    {
81
        //
82
    }
83
}
84