public function addRelationshipsInParents()
    {
        $options = config('generators.settings');
        if (!$options['model']) {
            $this->info('Model files not found.');

            return;
        }

        $modelSettings = $options['model'];

        // model names
        $modelOne = $this->getModelName($this->argument('tableOne'));
        $modelTwo = $this->getModelName($this->argument('tableTwo'));

        // model path
        $modelOnePath = $modelSettings['path'] . $modelOne . '.php';
        $modelTwoPath = $modelSettings['path'] . $modelTwo . '.php';

        $this->addRelationshipInModel($modelOnePath, $modelTwo, $this->argument('tableTwo'));
        $this->addRelationshipInModel($modelTwoPath, $modelOne, $this->argument('tableOne'));
    }
public function addRelationshipsInParents()
    {
        $options = config('generators.settings');
        if (!$options['model']) {
            $this->info('Model files not found.');

            return;
        }

        $modelSettings = $options['model'];

        // model names
        $modelOne = $this->getModelName($this->argument('tableOne'));
        $modelTwo = $this->getModelName($this->argument('tableTwo'));

        // model path
        $modelOnePath = $modelSettings['path'] . $modelOne . '.php';
        $modelTwoPath = $modelSettings['path'] . $modelTwo . '.php';

        $this->addRelationshipInModel($modelOnePath, $modelTwo, $this->argument('tableTwo'));
        $this->addRelationshipInModel($modelTwoPath, $modelOne, $this->argument('tableOne'));
    }
public function addRelationshipsInParents ( ) { $ options = config ( 'generators.settings' ) ; if ( ! $ options [ 'model' ] ) { $ this -> info ( 'Model files not found.' ) ; return ; } $ modelSettings = $ options [ 'model' ] ; // model names $ modelOne = $ this -> getModelName ( $ this -> argument ( 'tableOne' ) ) ; $ modelTwo = $ this -> getModelName ( $ this -> argument ( 'tableTwo' ) ) ; // model path $ modelOnePath = $ modelSettings [ 'path' ] . $ modelOne . '.php' ; $ modelTwoPath = $ modelSettings [ 'path' ] . $ modelTwo . '.php' ; $ this -> addRelationshipInModel ( $ modelOnePath , $ modelTwo , $ this -> argument ( 'tableTwo' ) ) ; $ this -> addRelationshipInModel ( $ modelTwoPath , $ modelOne , $ this -> argument ( 'tableOne' ) ) ; }
Append Many to Many Relationships in Parent Models
Append Many to Many Relationships in Parent Models