Issues (185)

app/Policies/RecruitmentPolicy.php (3 issues)

Severity
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\Recruitment;
6
use App\Models\User;
7
use Illuminate\Auth\Access\HandlesAuthorization;
8
9
class RecruitmentPolicy
10
{
11
    use HandlesAuthorization;
12
13
    public function view(User $user, Recruitment $recruitment)
14
    {
15
        if ($user->can('read all recruitments')) {
16
            return true;
17
        }
18
19
        if ($user->grantedRecruitments->contains($recruitment->id)) {
20
            return true;
21
        }
22
23
        return false;
24
    }
25
26
    public function update(User $user, Recruitment $recruitment)
0 ignored issues
show
The parameter $recruitment 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 update(User $user, /** @scrutinizer ignore-unused */ Recruitment $recruitment)

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
        if ($user->can('update any recruitment')) {
29
            return true;
30
        }
31
32
        return false;
33
    }
34
35
    public function close(User $user, Recruitment $recruitment)
0 ignored issues
show
The parameter $recruitment 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

35
    public function close(User $user, /** @scrutinizer ignore-unused */ Recruitment $recruitment)

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...
36
    {
37
        if ($user->can('update any recruitment')) {
38
            return true;
39
        }
40
41
        return false;
42
    }
43
44
    public function reopen(User $user, Recruitment $recruitment)
0 ignored issues
show
The parameter $recruitment 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 reopen(User $user, /** @scrutinizer ignore-unused */ Recruitment $recruitment)

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
        if ($user->can('update any recruitment')) {
47
            return true;
48
        }
49
50
        return false;
51
    }
52
53
    public function create(User $user)
54
    {
55
        if ($user->can('create recruitments')) {
56
            return true;
57
        }
58
59
        return false;
60
    }
61
62
    public function duplicate(User $user, Recruitment $recruitment)
63
    {
64
        if ($user->can('view', $recruitment) && $user->can('create recruitments')) {
65
            return true;
66
        }
67
68
        return false;
69
    }
70
}
71