private function generateEloquentModels($eloquentRules)
 {
     foreach ($eloquentRules as $table => $rules) {
         //we will create a new model here
         $hasMany = $rules['hasMany'];
         $hasOne = $rules['hasOne'];
         $belongsTo = $rules['belongsTo'];
         $belongsToMany = $rules['belongsToMany'];
         self::$namespace = env('APP_NAME', 'App\\Models');
         $modelName = $this->generateModelNameFromTableName($table);
         $fillable = implode(', ', $rules['fillable']);
         $belongsToFunctions = $this->generateBelongsToFunctions($belongsTo);
         $belongsToManyFunctions = $this->generateBelongsToManyFunctions($belongsToMany);
         $hasManyFunctions = $this->generateHasManyFunctions($hasMany);
         $hasOneFunctions = $this->generateHasOneFunctions($hasOne);
         $functions = $this->generateFunctions([$belongsToFunctions, $belongsToManyFunctions, $hasManyFunctions, $hasOneFunctions]);
         $filePathToGenerate = $this->getFileGenerationPath();
         $filePathToGenerate .= '/' . $modelName . '.php';
         $templateData = array('NAMESPACE' => self::$namespace, 'NAME' => $modelName, 'TABLENAME' => $table, 'FILLABLE' => $fillable, 'FUNCTIONS' => $functions);
         $templatePath = $this->getTemplatePath();
         $this->generator->make($templatePath, $templateData, $filePathToGenerate);
     }
 }
 private function generateEloquentModels($destinationFolder, $eloquentRules)
 {
     //0. set namespace
     self::$namespace = $this->getNamespace();
     foreach ($eloquentRules as $table => $rules) {
         try {
             $this->generateEloquentModel($destinationFolder, $table, $rules);
         } catch (Exception $e) {
             $this->error("\nFailed to generate model for table {$table}");
             return;
         }
     }
 }