Skip to content

Commit 4e24600

Browse files
committed
Allow value on model option. Fix #83 and #84.
1 parent e1f4af3 commit 4e24600

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Generators/DataTablesMakeCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class DataTablesMakeCommand extends GeneratorCommand
1515
*/
1616
protected $signature = 'datatables:make
1717
{name : The name of the datatable.}
18-
{--model : The name of the model to be used.}
18+
{--model= : The name of the model to be used.}
1919
{--model-namespace= : The namespace of the model to be used.}
2020
{--action= : The path of the action view.}
2121
{--table= : Scaffold columns from the table.}
@@ -190,9 +190,13 @@ protected function getModel()
190190
{
191191
$name = $this->getNameInput();
192192
$rootNamespace = $this->laravel->getNamespace();
193-
$model = $this->option('model') || $this->option('model-namespace');
193+
$model = $this->option('model') == '' || $this->option('model-namespace');
194194
$modelNamespace = $this->option('model-namespace') ? $this->option('model-namespace') : $this->laravel['config']->get('datatables-buttons.namespace.model');
195195

196+
if ($this->option('model') != '') {
197+
return $this->option('model');
198+
}
199+
196200
return $model
197201
? $rootNamespace . '\\' . ($modelNamespace ? $modelNamespace . '\\' : '') . Str::singular($name)
198202
: $rootNamespace . '\\User';

0 commit comments

Comments
 (0)