for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Policies;
use App\Models\User;
use App\Models\Customer;
use App\Traits\AllowTrait;
use Illuminate\Auth\Access\HandlesAuthorization;
class CustomerPolicy
{
use HandlesAuthorization;
use AllowTrait;
App\Traits\AllowTrait
App\Policies\CustomerPolicy
$role_id
$allow
/*
* Manage customers determines if they can deactivate and recover customers
*/
public function manage(User $user)
return $this->checkPermission($user, 'Manage Customers');
}
/**
* Determine whether the user can create new customers
public function create(User $user)
return $this->checkPermission($user, 'Add Customer');
* Determine if the user can update the customers basic details
public function update(User $user, Customer $customer)
$customer
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function update(User $user, /** @scrutinizer ignore-unused */ Customer $customer)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return $this->checkPermission($user, 'Update Customer');
* Determine if the user can deactivate the customer
public function delete(User $user, Customer $customer)
public function delete(User $user, /** @scrutinizer ignore-unused */ Customer $customer)
return $this->checkPermission($user, 'Deactivate Customer');
* Determine if the user can re-activate a deactivated customer
// public function restore(User $user, Customer $customer)
// {
// return $this->checkPermission($user, 'Manage Customers');
// }
* Determine if the user can permanently delete the customer and all associated information
// public function forceDelete(User $user, Customer $customer)
// return $this->checkPermission($user, 'Delete Customers');