Completed
Push — feature/delete_items ( 8d7f82 )
by Tristan
31:05 queued 19:23
created

SkillDeclarationPolicy::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

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 1
nc 1
nop 1
crap 2
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\SkillDeclaration;
7
use App\Policies\BasePolicy;
8
use Illuminate\Support\Facades\Log;
9
10
class SkillDeclarationPolicy extends BasePolicy
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class SkillDeclarationPolicy
Loading history...
11
{
12
13
    /**
14
     * Determine whether the user can view the skillDeclaration.
15
     *
16
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
17
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
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...
18
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
19
     */
20
    public function view(User $user, SkillDeclaration $skillDeclaration)
21
    {
22
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
23
    }
24
25
    /**
26
     * Determine whether the user can create skillDeclarations.
27
     *
28
     * @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...
29
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
30
     */
31
    public function create(User $user)
32
    {
33
        return $user->hasRole('applicant');
34
    }
35
36
    /**
37
     * Determine whether the user can update the skillDeclaration.
38
     *
39
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
40
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
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...
41
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
42
     */
43
    public function update(User $user, SkillDeclaration $skillDeclaration)
44
    {
45
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
46
    }
47
48
    /**
49
     * Determine whether the user can delete the skillDeclaration.
50
     *
51
     * @param  \App\Models\User  $user
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 13 spaces after parameter type; 2 found
Loading history...
52
     * @param  \App\Models\SkillDeclaration  $skillDeclaration
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...
53
     * @return mixed
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
54
     */
55
    public function delete(User $user, SkillDeclaration $skillDeclaration)
56
    {
57
        debugbar()->info($user);
58
        Log::info($user);
59
60
        return ($user->hasRole('applicant') && $skillDeclaration->applicant->user->is($user));
61
    }
62
}
63