Passed
Push — develop ( faa3f8...82f9ab )
by Francisco
03:19
created

ExchangePolicy   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 15
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A decide() 0 3 1
1
<?php
2
3
namespace App\Policies;
4
5
use App\Judite\Models\User;
6
use App\Judite\Models\Exchange;
7
use Illuminate\Auth\Access\HandlesAuthorization;
8
9
class ExchangePolicy
10
{
11
    use HandlesAuthorization;
12
13
    /**
14
     * Determine whether the user can make a decision on the given exchange.
15
     *
16
     * @param \App\Judite\Models\User     $user
17
     * @param \App\Judite\Models\Exchange $exchange
18
     *
19
     * @return bool
20
     */
21
    public function decide(User $user, Exchange $exchange)
22
    {
23
        return $user->id === $exchange->toEnrollment->student->user_id;
24
    }
25
}
26