for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Acacha\Users\Traits;
use Auth;
use Spatie\Permission\Models\Permission;
/**
* Class ExposePermissions.
*
* @package Acacha\Users\Traits
*/
trait ExposePermissions
{
* Get all user permissions in a flat array.
* @return array
public function getCanAttribute()
$permissions = [];
foreach (Permission::all() as $permission) {
if (Auth::check() && Auth::user()->can($permission->name)) {
$permissions[$permission->name] = true;
} else {
$permissions[$permission->name] = false;
}
return $permissions;
* Get all user permissions.
* @return \Illuminate\Support\Collection
public function getAllPermissionsAttribute()
return $this->getAllPermissions();
getAllPermissions()
Acacha\Users\Traits\ExposePermissions
getAllPermissionsAttribute()
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.