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 App\Tournament;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class TournamentPolicy
{
use HandlesAuthorization;
/**
* Create a new policy instance.
* @param User $user
* @param $ability
* @return bool
*/
public function before(User $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 $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->isSuperAdmin()) {
return true;
}
return null;
// You can create a user if you are not a simple user
public function create(User $user)
$user
public function create(/** @scrutinizer ignore-unused */ User $user)
// You can store a user if you are not a simple user
public function store(User $user, Tournament $tournament)
$tournament
public function store(User $user, /** @scrutinizer ignore-unused */ Tournament $tournament)
public function store(/** @scrutinizer ignore-unused */ User $user, Tournament $tournament)
public function edit(User $user, Tournament $tournament)
return ($tournament->user_id == $user->id || $user->isSuperAdmin());
public function update(User $user, Tournament $tournament)
public function destroy(User $user, Tournament $tournament)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.