for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Microboard\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view any models.
*
* @param \App\User $user
* @return mixed
*/
public function viewAny(User $user)
return $user->permissions()->contains('name', 'users-viewAny');
}
* Determine whether the user can view the model.
* @param \App\User $model
public function view(User $user, User $model)
return $user->is($model) || $user->permissions()->contains('name', 'users-view');
* Determine whether the user can create models.
public function create(User $user)
return $user->permissions()->contains('name', 'users-create');
* Determine whether the user can update the model.
public function update(User $user, User $model)
return $user->is($model) || $user->permissions()->contains('name', 'users-update');
* Determine whether the user can delete the model.
public function delete(User $user, User $model)
return $user->isNot($model) ? $user->permissions()->contains('name', 'users-delete') : false;