ReferencePolicy::view()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 3
nop 2
crap 12
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\Applicant;
6
use App\Models\User;
7
use App\Models\Reference;
8
use App\Policies\BasePolicy;
9
10
class ReferencePolicy extends BasePolicy
11
{
12
13
    /**
14
     * Determine whether the user can view the reference.
15
     *
16
     * @param  \App\Models\User  $user
17
     * @param  \App\Models\Reference  $reference
18
     * @return mixed
19
     */
20
    public function view(User $user, Reference $reference)
21
    {
22
        return $user->isApplicant()
23
            && $reference->referenceable instanceof Applicant
24
            && $reference->referenceable->user->is($user);
25
    }
26
27
    /**
28
     * Determine whether the user can create references.
29
     *
30 1
     * @param  \App\Models\User  $user
31
     * @return mixed
32 1
     */
33
    public function create(User $user)
34
    {
35
        return false;
36
    }
37
38
    /**
39
     * Determine whether the user can update the reference.
40
     *
41
     * @param  \App\Models\User  $user
42 1
     * @param  \App\Models\Reference  $reference
43
     * @return mixed
44 1
     */
45
    public function update(User $user, Reference $reference)
46
    {
47
        return false;
48
    }
49
50
    /**
51
     * Determine whether the user can delete the reference.
52
     *
53
     * @param  \App\Models\User  $user
54 1
     * @param  \App\Models\Reference  $reference
55
     * @return mixed
56 1
     */
57
    public function delete(User $user, Reference $reference)
58
    {
59
        return false;
60
    }
61
}
62