@param string $permission

@return bool

@throws \Exception
493252
public function hasPermission($permission): bool
    {
        if (!\in_array($permission, $this::$permissions, true)) {
            throw new \UnexpectedValueException("Permissions does not exists: {$permission}");
        }
        $accessor = PropertyAccess::createPropertyAccessor();

        return $accessor->getValue($this, $permission);
    }
1213715
public function grant($permission)
    {
        $commandClass = $this->getCommandClass('grant');
        $this->command = new $commandClass($permission);

        return $this->command;
    }
156071
public function hasPermission($permission, $requireAll = false)
    {
        return $this->laratrustRoleChecker($this)
            ->currentRoleHasPermission($permission, $requireAll);
    }
142771
public function currentRoleHasPermission($permission, $requireAll = false)
    {
        if (is_array($permission)) {
            if (empty($permission)) {
                return true;
            }

            foreach ($permission as $permissionName) {
                $hasPermission = $this->currentRoleHasPermission($permissionName);

                if ($hasPermission && !$requireAll) {
                    return true;
                } elseif (!$hasPermission && $requireAll) {
                    return false;
                }
            }

            // If we've made it this far and $requireAll is FALSE, then NONE of the permissions were found.
            // If we've made it this far and $requireAll is TRUE, then ALL of the permissions were found.
            // Return the value of $requireAll.
            return $requireAll;
        }

        foreach ($this->currentRoleCachedPermissions() as $perm) {
            if (str_is($permission, $perm['name'])) {
                return true;
            }
        }

        return false;
    }
408162
public function hasPermissionTo($permission): bool
    {
        if (is_string($permission)) {
            $permission = PermissionProxy::findByName($permission, $this->getDefaultGuardName());
        }

        if (! $this->getGuardNames()->contains($permission->guard_name)) {
            throw GuardDoesNotMatch::create($permission->guard_name, $this->getGuardNames());
        }

        return $this->permissions->contains('id', $permission->id);
    }
186763
public function hasPermission($permission)
    {
        foreach ($this->permissions()->get() as $p) {
            if ($p->name == $permission) {
                return true;
            }
        }
        return false;
    }
948066
protected function checkPermission(array $prepared, $permission)
    {
        if (array_key_exists($permission, $prepared) && $prepared[$permission] === true) {
            return true;
        }

        $permission = (string) $permission;

        foreach ($prepared as $key => $value) {
            $key = (string) $key;

            if ((str_is($permission, $key) || str_is($key, $permission)) && $value === true) {
                return true;
            }
        }

        return false;
    }
846644
protected function checkPermission($permission = 'manage', $role = 'admin')
    {
        if ($this->auth->guest()) {
            return 401;
        }

        if ($this->auth->user()->can($permission) || $this->auth->user()->hasRole($role)) {
            return true;
        }

        return 403;
    }
1327200
public static function check($permission)
    {
        if (static::isAdministrator()) {
            return true;
        }

        if (is_array($permission)) {
            collect($permission)->each(function ($permission) {
                call_user_func([Permission::class, 'check'], $permission);
            });

            return;
        }

        if (Auth::guard('merchant')->user()->cannot($permission)) {
            static::error();
        }
    }
520351
protected function getPermission($permission)
    {
        $name = $permission instanceof Permission
            ? $permission->getName()
            : $permission;

        return $this->permissions->filter(function(Permission $current) use ($name) {
            return $current->getName() == $name;
        })->first();
    }
1316323
public static function require (string $permission): bool {
		if (empty($permission)) {
			return true;
		}

		return self::$user->hasPermission($permission);
	}
640400
public function getPermission($permission)
    {
        if ($permission instanceof PermissionInterface) {
            $permission =   $permission->key;
        }

        return $this->permissions()
            ->key($permission)
            ->first();
    }
731251
function is_permission_requested( $permission ) {
            return isset( $this->_permissions[ $permission ] ) && ( true === $this->_permissions[ $permission ] );
        }
1360998
public function addPermission($permission)
    {
        if (!$this->hasPermission($permission)) {
            return PermissionRole::create(['role_id' => $this->id, 'permission_id' => $permission->id]);
        }

        return false;
    }
723561
public function addPermission($permission)
    {
        if (is_string($permission)) {
            $name       = $permission;
            $permission = $this->createPermission($name);
        } elseif ($permission instanceof PermissionInterface) {
            $name = $permission->getName();
        } else {
            throw new \InvalidArgumentException('Permission must be a string or implement PermissionInterface');
        }

        $this->permissions[$name] = $permission;
        return $permission;
    }
424444
public function hasPermission($permission)
    {
        $permissions = $this->permissions;
        foreach ($permissions as $permission_obj)
            if ($this->checkPermission($permission, $permission_obj))
                return true;

        return false;
    }
217857
public function findWithoutPermission($permission)
    {
        return array_filter(
            $this->findAll(),
            function ($user) use ($permission) {
                return $user->hasnt($permission);
            }
        );
    }