Passed
Push — task/refactor-application-data... ( 30e714...e7ce5c )
by Tristan
04:51
created

JobApplicationAnswerPolicy::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\JobApplicationAnswer;
6
use App\Models\User;
7
use App\Policies\BasePolicy;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
use Illuminate\Support\Facades\Log;
10
11
class JobApplicationAnswerPolicy extends BasePolicy
12
{
13
    use HandlesAuthorization;
14
15
    /**
16
     * Determine whether the user can create JobApplicationAnswer.
17
     *
18
     * @param  \App\Models\User  $user
19
     * @return mixed
20
     */
21
    public function create(User $user)
22
    {
23
        return $user->isApplicant();
24
    }
25
26
    /**
27
     * Determine whether the user can update the JobApplicationAnswer object.
28
     *
29
     * @param  \App\Models\User  $user
30
     * @param  JobApplicationAnswer $jobApplicationAnswer
31
     * @return mixed
32
     */
33
    public function update(User $user, JobApplicationAnswer $jobApplicationAnswer)
34
    {
35
        return $user->can('update', $jobApplicationAnswer->job_application);
36
    }
37
}
38