src/Reflex/Lockdown/Users/Eloquent/User.php
public function give(PermissionInterface $permission, $level = 'allow')
    {
        $current    =   $this->getPermission($permission->key);
        if (isset($current)) {
            if ($current->level === $level) {
                return true;
            }
            $this->remove($permission);
        }

        $this->removeFromLocalCache($permission->key);

        $this->permissions()->attach($permission, compact('level'));

        return false === is_null($this->getPermission($permission));
    }
public function give(PermissionInterface $permission, $level = 'allow')
    {
        $current    =   $this->getPermission($permission->key);
        if (isset($current)) {
            if ($current->level === $level) {
                return true;
            }
            $this->remove($permission);
        }

        $this->removeFromLocalCache($permission->key);

        $this->permissions()->attach($permission, compact('level'));

        return false === is_null($this->getPermission($permission));
    }
public function give ( PermissionInterface $ permission , $ level = 'allow' ) { $ current = $ this -> getPermission ( $ permission -> key ) ; if ( isset ( $ current ) ) { if ( $ current -> level === $ level ) { return true ; } $ this -> remove ( $ permission ) ; } $ this -> removeFromLocalCache ( $ permission -> key ) ; $ this -> permissions ( ) -> attach ( $ permission , compact ( 'level' ) ) ; return false === is_null ( $ this -> getPermission ( $ permission ) ) ; }
Give a permission to the user
@param  PermissionInterface $permission
@param  string              $level
@return boolean
Give a permission to the user