src/Searsaw/Drawbridge/models/BridgeRole.php
public function addPermissionByName($permission_name)
    {
        $permission = static::$app['db']->connection()
            ->table('permissions')->where('name', '=', $permission_name)->first();

        if (! $permission)
            return new \RuntimeException('No permission with that name found.');

        if (is_array($permission))
            return $this->addPermissionById($permission['id']);
        elseif (is_object($permission))
            return $this->addPermissionById($permission->id);
        else
            throw new \UnexpectedValueException('Value returned not array or instance of BridgePermission.');
    }
public function addPermissionByName($permission_name)
    {
        $permission = static::$app['db']->connection()
            ->table('permissions')->where('name', '=', $permission_name)->first();

        if (! $permission)
            return new \RuntimeException('No permission with that name found.');

        if (is_array($permission))
            return $this->addPermissionById($permission['id']);
        elseif (is_object($permission))
            return $this->addPermissionById($permission->id);
        else
            throw new \UnexpectedValueException('Value returned not array or instance of BridgePermission.');
    }
public function addPermissionByName ( $ permission_name ) { $ permission = static :: $ app [ 'db' ] -> connection ( ) -> table ( 'permissions' ) -> where ( 'name' , '=' , $ permission_name ) -> first ( ) ; if ( ! $ permission ) return new \ RuntimeException ( 'No permission with that name found.' ) ; if ( is_array ( $ permission ) ) return $ this -> addPermissionById ( $ permission [ 'id' ] ) ; elseif ( is_object ( $ permission ) ) return $ this -> addPermissionById ( $ permission -> id ) ; else throw new \ UnexpectedValueException ( 'Value returned not array or instance of BridgePermission.' ) ; }
Add a single permission to the role by name

@param $permission_name string The name of the permission to add

@throws \UnexpectedValueException
@throws \RuntimeException

@return \Searsaw\Drawbridge\Models\BridgePermission
Add a single permission to the role by name