protected function buildRelationshipQuery($field_parameters)
    {
        if (isset($field_parameters['table']) && ! $this->onlyQueryFrom == 'model') {
            $table = $field_parameters['table'];

            return DB::table($table);
        } elseif (isset($field_parameters['model']) && ! $this->onlyQueryFrom == 'table') {
            $class = $field_parameters['model'];
            $model = new $class;

            if ($model instanceof Model) {
                return $model;
            }

            throw new Exception('Class \''.$class.'\' must be an isntance of \''.Model::class.'\'');
        }

        throw new Exception('No valid query to build from field parameters');
    }
protected function buildRelationshipQuery($field_parameters)
    {
        if (isset($field_parameters['table']) && ! $this->onlyQueryFrom == 'model') {
            $table = $field_parameters['table'];

            return DB::table($table);
        } elseif (isset($field_parameters['model']) && ! $this->onlyQueryFrom == 'table') {
            $class = $field_parameters['model'];
            $model = new $class;

            if ($model instanceof Model) {
                return $model;
            }

            throw new Exception('Class \''.$class.'\' must be an isntance of \''.Model::class.'\'');
        }

        throw new Exception('No valid query to build from field parameters');
    }
protected function buildRelationshipQuery ( $ field_parameters ) { if ( isset ( $ field_parameters [ 'table' ] ) && ! $ this -> onlyQueryFrom == 'model' ) { $ table = $ field_parameters [ 'table' ] ; return DB :: table ( $ table ) ; } elseif ( isset ( $ field_parameters [ 'model' ] ) && ! $ this -> onlyQueryFrom == 'table' ) { $ class = $ field_parameters [ 'model' ] ; $ model = new $ class ; if ( $ model instanceof Model ) { return $ model ; } throw new Exception ( 'Class \'' . $ class . '\' must be an isntance of \'' . Model :: class . '\'' ) ; } throw new Exception ( 'No valid query to build from field parameters' ) ; }
Builds base query for relationship, using field parameters specified.

@param string $field_parameters

@return \Illuminate\Database\Query\Builder
@throws \Exception
Builds base query for relationship using field parameters specified .