protected function getRelations()
    {
        // Based on Barryvdh\LaravelIdeHelper\Console\ModelsCommand::getPropertiesFromMethods().
        return collect(get_class_methods($this->model))
            ->reject(function ($methodName) {
                return method_exists(Model::class, $methodName);
            })
            ->filter(function ($methodName) {
                $methodCode = $this->getMethodCode($methodName);

                return collect([
                    'belongsTo',
                    'morphTo',
                    'morphOne',
                    'morphMany',
                    'belongsToMany',
                    'morphedByMany',
                ])->contains(function ($relationName) use ($methodCode) {
                    return stripos($methodCode, "\$this->$relationName(");
                });
            })
            ->map(function ($methodName) {
                return $this->model->$methodName();
            })
            ->filter(function ($relation) {
                return $relation instanceof Relation;
            })
            ->all();
    }
protected function getRelations()
    {
        // Based on Barryvdh\LaravelIdeHelper\Console\ModelsCommand::getPropertiesFromMethods().
        return collect(get_class_methods($this->model))
            ->reject(function ($methodName) {
                return method_exists(Model::class, $methodName);
            })
            ->filter(function ($methodName) {
                $methodCode = $this->getMethodCode($methodName);

                return collect([
                    'belongsTo',
                    'morphTo',
                    'morphOne',
                    'morphMany',
                    'belongsToMany',
                    'morphedByMany',
                ])->contains(function ($relationName) use ($methodCode) {
                    return stripos($methodCode, "\$this->$relationName(");
                });
            })
            ->map(function ($methodName) {
                return $this->model->$methodName();
            })
            ->filter(function ($relation) {
                return $relation instanceof Relation;
            })
            ->all();
    }
protected function getRelations ( ) { // Based on Barryvdh\LaravelIdeHelper\Console\ModelsCommand::getPropertiesFromMethods(). return collect ( get_class_methods ( $ this -> model ) ) -> reject ( function ( $ methodName ) { return method_exists ( Model :: class , $ methodName ) ; } ) -> filter ( function ( $ methodName ) { $ methodCode = $ this -> getMethodCode ( $ methodName ) ; return collect ( [ 'belongsTo' , 'morphTo' , 'morphOne' , 'morphMany' , 'belongsToMany' , 'morphedByMany' , ] ) -> contains ( function ( $ relationName ) use ( $ methodCode ) { return stripos ( $ methodCode , "\$this->$relationName(" ) ; } ) ; } ) -> map ( function ( $ methodName ) { return $ this -> model -> $ methodName ( ) ; } ) -> filter ( function ( $ relation ) { return $ relation instanceof Relation ; } ) -> all ( ) ; }
Get the model's relations.

@return Relation[]
Get the model s relations .