Skip to content

Commit

Permalink
InfyOmLabs#208 Allow ignore for models
Browse files Browse the repository at this point in the history
  • Loading branch information
wxs77577 committed Dec 28, 2016
1 parent 849767d commit 4ca929f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config/laravel_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,12 @@
'deleted_at' => 'deleted_at',
],

/*
|--------------------------------------------------------------------------
| Save model files to `App/Models` when use `--prefix`. see #208
|--------------------------------------------------------------------------
|
*/
'ignore_model_prefix' => false,

];
6 changes: 6 additions & 0 deletions src/Common/GeneratorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public function loadNamespaces(CommandData &$commandData)
$this->nsApp = substr($this->nsApp, 0, strlen($this->nsApp) - 1);
$this->nsRepository = config('infyom.laravel_generator.namespace.repository', 'App\Repositories').$prefix;
$this->nsModel = config('infyom.laravel_generator.namespace.model', 'App\Models').$prefix;
if (config('infyom.laravel_generator.ignore_model_prefix', false)) {
$this->nsModel = config('infyom.laravel_generator.namespace.model', 'App\Models');
}
$this->nsDataTables = config('infyom.laravel_generator.namespace.datatables', 'App\DataTables').$prefix;
$this->nsModelExtend = config(
'infyom.laravel_generator.model_extend_class',
Expand Down Expand Up @@ -153,6 +156,9 @@ public function loadPaths()
).$prefix;

$this->pathModel = config('infyom.laravel_generator.path.model', app_path('Models/')).$prefix;
if (config('infyom.laravel_generator.ignore_model_prefix', false)) {
$this->pathModel = config('infyom.laravel_generator.path.model', app_path('Models/'));
}

$this->pathDataTables = config('infyom.laravel_generator.path.datatables', app_path('DataTables/')).$prefix;

Expand Down

0 comments on commit 4ca929f

Please sign in to comment.