Пример #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // This is the model that all your others will extend
     $baseModel = '\\Illuminate\\Database\\Eloquent\\Model';
     // default laravel 5
     // This is the path where we will store your new models
     $path = app_path($this->option('folder'));
     // The namespace of the models
     $namespace = $this->option('namespace');
     // default namespace for clean laravel 5 installation
     // get the prefix from the config
     $prefix = ModelBuilder\Database::getTablePrefix();
     $generator = new ModelBuilder\ModelGenerator($baseModel, $path, $namespace, $prefix);
     $generator->start();
 }
 public function start()
 {
     // This is the model that all your others will extend
     $baseModel = '\\Illuminate\\Database\\Eloquent\\Model';
     // default laravel 5
     // This is the path where we will store your new models
     $path = storage_path('models');
     // The namespace of the models
     $namespace = 'App';
     // default namespace for clean laravel 5 installation
     // get the prefix from the config
     $prefix = Database::getTablePrefix();
     $generator = new ModelGenerator($baseModel, $path, $namespace, $prefix);
     $generator->start();
 }
 public function start()
 {
     // This is the model that all your others will extend
     $baseModel = 'Eloquent';
     // default laravel 4.2
     // This is the path where we will store your new models
     $path = storage_path('models');
     // The namespace of the models
     $namespace = '';
     // by default laravel 4 doesn't use namespaces
     // get the prefix from the config
     $prefix = Database::getTablePrefix();
     $generator = new ModelGenerator($baseModel, $path, $namespace, $prefix);
     $generator->start();
 }
 /**
  * Return an array with tables, with arrays of foreign keys.
  *
  * @return array|mixed
  */
 protected function getAllForeignKeysOrderedByTable()
 {
     $results = Database::getAllForeignKeys();
     $results = ArrayHelpers::orderArrayByValue($results, 'TABLE_NAME');
     return $results;
 }