Passed
Push — develop ( dfa246...179c36 )
by Francisco
02:27
created

EnrollmentPolicy::exchange()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Policies;
4
5
use App\Judite\Models\User;
6
use App\Judite\Models\Enrollment;
7
use Illuminate\Auth\Access\HandlesAuthorization;
8
9
class EnrollmentPolicy
10
{
11
    use HandlesAuthorization;
12
13
    /**
14
     * Determine whether the user can exchange an enrollment.
15
     *
16
     * @param \App\Judite\Models\User       $user
17
     * @param \App\Judite\Models\Enrollment $enrollment
18
     *
19
     * @return bool
20
     */
21
    public function exchange(User $user, Enrollment $enrollment)
22
    {
23
        return $user->id === $enrollment->student->user_id;
24
    }
25
}
26