src/Gzero/Core/Models/User.php
public function hasPermission($permission)
    {
        if (!is_array($this->permissionsMap)) {
            $permissionsMap = cache()->get('permissions:' . $this->id, null);
            if ($permissionsMap === null) { // Not in cache
                $this->permissionsMap = $this->buildPermissionsMap();
                cache()->forever('permissions:' . $this->id, $this->permissionsMap);
            } else {
                $this->permissionsMap = $permissionsMap;
            }
        }
        return in_array($permission, $this->permissionsMap);
    }
public function hasPermission($permission)
    {
        if (!is_array($this->permissionsMap)) {
            $permissionsMap = cache()->get('permissions:' . $this->id, null);
            if ($permissionsMap === null) { // Not in cache
                $this->permissionsMap = $this->buildPermissionsMap();
                cache()->forever('permissions:' . $this->id, $this->permissionsMap);
            } else {
                $this->permissionsMap = $permissionsMap;
            }
        }
        return in_array($permission, $this->permissionsMap);
    }
public function hasPermission ( $ permission ) { if ( ! is_array ( $ this -> permissionsMap ) ) { $ permissionsMap = cache ( ) -> get ( 'permissions:' . $ this -> id , null ) ; if ( $ permissionsMap === null ) { // Not in cache $ this -> permissionsMap = $ this -> buildPermissionsMap ( ) ; cache ( ) -> forever ( 'permissions:' . $ this -> id , $ this -> permissionsMap ) ; } else { $ this -> permissionsMap = $ permissionsMap ; } } return in_array ( $ permission , $ this -> permissionsMap ) ; }
It checks if given user have specified permission

@param string $permission Permission name

@return bool
It checks if given user have specified permission