Skip to content

Commit 272f726

Browse files
committed
added support for Laravel 8.x if Models directory exists then use Models directory in namespace for model
1 parent 8b8a77a commit 272f726

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)