Skip to content

Commit c255bf5

Browse files
authored
Merge pull request #117 from luckys383/create_model_to_models_dir_if_exists
Added support for Laravel 8.x if Models directory exists.
2 parents 8b8a77a + f093ddf commit c255bf5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Generators/DataTablesMakeCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ protected function getModel()
361361
return $this->option('model');
362362
}
363363

364+
// check if model namespace is not set in command and Models directory already exists then use that directory in namespace.
365+
if ($modelNamespace == '') {
366+
$modelNamespace = is_dir(app_path('Models')) ? 'Models' : $rootNamespace;
367+
}
368+
364369
return $model
365370
? $rootNamespace . '\\' . ($modelNamespace ? $modelNamespace . '\\' : '') . Str::singular($name)
366371
: $rootNamespace . '\\User';

0 commit comments

Comments
 (0)