27 lines
537 B
PHP
27 lines
537 B
PHP
<?php
|
|
|
|
namespace App\Policies;
|
|
|
|
use App\Models\Customer;
|
|
use App\Models\Service;
|
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
|
|
|
/**
|
|
* @codeCoverageIgnore
|
|
*/
|
|
class CustomerPolicy
|
|
{
|
|
use HandlesAuthorization;
|
|
|
|
/**
|
|
* Check if the customer belongs to the service
|
|
*
|
|
* @param Service $service
|
|
* @param Customer $customer
|
|
* @return boolean
|
|
*/
|
|
public function customerBelongsToService(Service $service, Customer $customer)
|
|
{
|
|
return !\is_null($customer->login($service->brand));
|
|
}
|
|
}
|