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\Manager;
use App\Policies\BasePolicy;
class ManagerPolicy extends BasePolicy
{
/**
* Determine whether the user can view the manager.
*
* @param \App\Models\User $user
* @param \App\Models\Manager $manager
* @return mixed
*/
public function view(User $user, Manager $manager)
$manager
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function view(User $user, /** @scrutinizer ignore-unused */ Manager $manager)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
//Manager profiles are viewable by any logged-in user
return $user != null;
}
* Determine whether the user can create managers.
public function create(User $user)
$user
public function create(/** @scrutinizer ignore-unused */ User $user)
return false;
* Determine whether the user can update the manager.
public function update(User $user, Manager $manager)
//Mangers can only update their own profiles
return $user->hasRole('manager') &&
$manager->user_id == $user->id;
* Determine whether the user can delete the manager.
public function delete(User $user, Manager $manager)
public function delete(/** @scrutinizer ignore-unused */ User $user, Manager $manager)
public function delete(User $user, /** @scrutinizer ignore-unused */ Manager $manager)