Passed
Push — task/add-application-review-bu... ( a9dfc5 )
by Chris
05:31
created

ApplicationReviewPolicy::update()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
namespace App\Policies;
4
5
use App\Models\User;
6
use App\Models\ApplicationReview;
7
use App\Policies\BasePolicy;
8
use Illuminate\Auth\Access\HandlesAuthorization;
9
10
class ApplicationReviewPolicy extends BasePolicy
11
{
12
    use HandlesAuthorization;
13
14
    /**
15
     * Determine whether the user can update the Application Review.
16
     *
17
     * @param  User  $user
18
     * @param  ApplicationReview  $applicationReview
19
     * @return mixed
20
     */
21
    public function update(User $user, ApplicationReview $applicationReview)
22
    {
23
        $user->loadMissing('manager');
24
        // TODO: Is there business logic around who can update/create application reviews?
25
        // Does it need to be the manager who created the Job Poster, or can it be any manager/HR advisor?
26
        // $applicationReview->loadMissing('job_application.job_poster.manager');
27
        // return $user->isUpgradedManager() &&
28
        //     $applicationReview->job_application->job_poster->manager->id === $user->manager->id;
29
        return $user->isUpgradedManager();
30
    }
31
}
32