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\Policies\BasePolicy;
class UserPolicy extends BasePolicy
{
/**
* Determine whether the user can view the target user.
*
* @param \App\Models\User $user
* @param \App\Models\User $targetUser
* @return mixed
*/
public function view(User $user, User $targetUser)
return $user->id === $targetUser->id;
}
* Determine whether the user can create courses.
public function create(User $user)
$user
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function create(/** @scrutinizer ignore-unused */ User $user)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return false;
* Determine whether the user can update the target user.
public function update(User $user, User $targetUser)
* Determine whether the user can delete the target user.
public function delete(User $user, User $targetUser)
$targetUser
public function delete(User $user, /** @scrutinizer ignore-unused */ User $targetUser)
public function delete(/** @scrutinizer ignore-unused */ User $user, User $targetUser)