for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Xetaravel\Policies;
use Xetaravel\Models\User;
use Xetaravel\Models\Comment;
use Illuminate\Auth\Access\HandlesAuthorization;
class BlogCommentPolicy
{
use HandlesAuthorization;
/**
* Authorize all actions if the user has the given permission.
*
* @param \Xetaravel\Models\User $user
* @param string $ability
* @return true|void
*/
public function before(User $user, string $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 */ string $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->hasPermission('manage.blog.comments')) {
return true;
}
* Determine whether the user can update the discuss post.
* @param \Xetaravel\Models\Comment $comment
* @return bool
public function update(User $user, Comment $comment)
return $user->id === $comment->user_id;
* Determine whether the user can delete the discuss post.
public function delete(User $user, Comment $comment)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.