Completed
Push — task/accessibility-audit-fixes ( 1e0e3b )
by Grant
22s queued 11s
created

SkillDeclarationPolicy::view()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 6
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\SkillDeclaration;
7
use App\Policies\BasePolicy;
8
9
class SkillDeclarationPolicy extends BasePolicy
10
{
11
12
    /**
13
     * Determine whether the user can view the skillDeclaration.
14
     *
15
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
16
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
17
     * @return mixed
18
     */
19
    public function view(User $user, SkillDeclaration $skillDeclaration)
20
    {
21
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
22
    }
23
24
    /**
25
     * Determine whether the user can create skillDeclarations.
26
     *
27
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
28
     * @return mixed
29
     */
30
    public function create(User $user)
31
    {
32
        return $user->hasRole('applicant');
33
    }
34
35
    /**
36
     * Determine whether the user can update the skillDeclaration.
37
     *
38
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
39
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
40
     * @return mixed
41
     */
42 1
    public function update(User $user, SkillDeclaration $skillDeclaration)
43
    {
44 1
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
45
    }
46
47
    /**
48
     * Determine whether the user can delete the skillDeclaration.
49
     *
50
     * @param  \App\Models\User  $user
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
51
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
52
     * @return mixed
53
     */
54
    public function delete(User $user, SkillDeclaration $skillDeclaration)
55
    {
56
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
57
    }
58
}
59