diff --git a/doc/usage.md b/doc/usage.md index b0256ee5..2c96fbe8 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -3,7 +3,7 @@ ### CRUD Command ``` -php artisan crud:generate Posts --fields='title#string; content#text; category#select#options={"technology": "Technology", "tips": "Tips", "health": "Health"}' --view-path=admin --controller-namespace=Admin --route-group=admin --form-helper=html +php artisan crud:generate Posts --fields='title#string; content#text; category#select#options={"technology": "Technology", "tips": "Tips", "health": "Health"}' --view-path=admin --controller-namespace=App\\Http\\Controllers\\Admin --route-group=admin --form-helper=html ``` #### CRUD fields from a JSON file: @@ -45,7 +45,7 @@ php artisan crud:generate Posts --fields='title#string; content#text; category#s { "name": "user", "type": "belongsTo", - "class": "App\\User" + "class": "App\\Models\\User" } ], "validations": [ @@ -58,7 +58,7 @@ php artisan crud:generate Posts --fields='title#string; content#text; category#s ``` ``` -php artisan crud:generate Posts --fields_from_file="/path/to/fields.json" --view-path=admin --controller-namespace=Admin --route-group=admin --form-helper=html +php artisan crud:generate Posts --fields_from_file="/path/to/fields.json" --view-path=admin --controller-namespace=App\\Http\\Controllers\\Admin --route-group=admin --form-helper=html ``` ### Other Commands diff --git a/src/Commands/CrudApiCommand.php b/src/Commands/CrudApiCommand.php index 8c8416c4..473c9542 100644 --- a/src/Commands/CrudApiCommand.php +++ b/src/Commands/CrudApiCommand.php @@ -69,7 +69,7 @@ public function handle() $perPage = intval($this->option('pagination')); $controllerNamespace = ($this->option('controller-namespace')) ? $this->option('controller-namespace') . '\\' : ''; - $modelNamespace = ($this->option('model-namespace')) ? trim($this->option('model-namespace')) . '\\' : ''; + $modelNamespace = ($this->option('model-namespace')) ? trim($this->option('model-namespace')) . '\\' : 'Models\\'; $fields = rtrim($this->option('fields'), ';'); diff --git a/src/Commands/CrudCommand.php b/src/Commands/CrudCommand.php index 84f041cb..f9cfc317 100644 --- a/src/Commands/CrudCommand.php +++ b/src/Commands/CrudCommand.php @@ -73,7 +73,7 @@ public function handle() $perPage = intval($this->option('pagination')); $controllerNamespace = ($this->option('controller-namespace')) ? $this->option('controller-namespace') . '\\' : ''; - $modelNamespace = ($this->option('model-namespace')) ? trim($this->option('model-namespace')) . '\\' : ''; + $modelNamespace = ($this->option('model-namespace')) ? trim($this->option('model-namespace')) . '\\' : 'Models\\'; $fields = rtrim($this->option('fields'), ';');