Passed
Push — bugfix/job_translation_fields ( dcec43...2ad85b )
by Tristan
14:10
created

WorkExperiencePolicy::create()   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
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\WorkExperience;
7
use App\Policies\BasePolicy;
8
9
class WorkExperiencePolicy extends BasePolicy
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class WorkExperiencePolicy
Loading history...
10
{
11
12
    /**
13
     * Determine whether the user can view the workExperience.
14
     *
15
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 11 spaces after parameter type; 2 found
Loading history...
16
     * @param  \App\Models\WorkExperience  $workExperience
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
17
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
18
     */
19
    public function view(User $user, WorkExperience $workExperience)
20
    {
21
        return $user->hasRole('applicant') && $workExperience->applicant->user->is($user);
22
    }
23
24
    /**
25
     * Determine whether the user can create workExperiences.
26
     *
27
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
28
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
29
     */
30
    public function create(User $user)
31
    {
32
        return $user->hasRole('applicant');
33
    }
34
35
    /**
36
     * Determine whether the user can update the workExperience.
37
     *
38
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 11 spaces after parameter type; 2 found
Loading history...
39
     * @param  \App\Models\WorkExperience  $workExperience
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
40
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
41
     */
42
    public function update(User $user, WorkExperience $workExperience)
43
    {
44
        return $user->hasRole('applicant') && $workExperience->applicant->user->is($user);
45
    }
46
47
    /**
48
     * Determine whether the user can delete the workExperience.
49
     *
50
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 11 spaces after parameter type; 2 found
Loading history...
51
     * @param  \App\Models\WorkExperience  $workExperience
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
52
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
53
     */
54
    public function delete(User $user, WorkExperience $workExperience)
55
    {
56
        return $user->hasRole('applicant') && $workExperience->applicant->user->is($user);
57
    }
58
}
59