Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| CustomerPolicy | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | n/a |
0 / 0 |
|||
| customerBelongsToService | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Policies; |
| 4 | |
| 5 | use App\Models\Customer; |
| 6 | use App\Models\Service; |
| 7 | use Illuminate\Auth\Access\HandlesAuthorization; |
| 8 | |
| 9 | /** |
| 10 | * @codeCoverageIgnore |
| 11 | */ |
| 12 | class CustomerPolicy |
| 13 | { |
| 14 | use HandlesAuthorization; |
| 15 | |
| 16 | /** |
| 17 | * Check if the customer belongs to the service |
| 18 | * |
| 19 | * @param Service $service |
| 20 | * @param Customer $customer |
| 21 | * @return boolean |
| 22 | */ |
| 23 | public function customerBelongsToService(Service $service, Customer $customer) |
| 24 | { |
| 25 | return !\is_null($customer->login($service->brand)); |
| 26 | } |
| 27 | } |