for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Policies;
use Illuminate\Auth\Access\HandlesAuthorization;
use Illuminate\Support\Facades\Log;
class BasePolicy
{
use HandlesAuthorization;
public function before($user, $ability)
$ability
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function before($user, /** @scrutinizer ignore-unused */ $ability)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
if ($user->user_role->name == 'admin') {
$userText = '{id='.$user->id.'}';
Log::notice('User '.$userText.' has bypassed policy as an Admin');
return true;
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.