diff --git a/src/Commands/GeneratorCommand.php b/src/Commands/GeneratorCommand.php index a08cbe2..338feda 100644 --- a/src/Commands/GeneratorCommand.php +++ b/src/Commands/GeneratorCommand.php @@ -81,6 +81,10 @@ public function __construct(Filesystem $files) $this->unwantedColumns = config('crud.model.unwantedColumns', $this->unwantedColumns); $this->modelNamespace = config('crud.model.namespace', $this->modelNamespace); $this->controllerNamespace = config('crud.controller.namespace', $this->controllerNamespace); + $this->apiControllerNamespace = config('crud.controller.apiNamespace', $this->apiControllerNamespace); + $this->resourceNamespace = config('crud.resources.namespace', $this->resourceNamespace); + $this->livewireNamespace = config('crud.livewire.namespace', $this->livewireNamespace); + $this->requestNamespace = config('crud.request.namespace', $this->requestNamespace); $this->layout = config('crud.layout', $this->layout); } @@ -147,7 +151,7 @@ protected function getStub(string $type, bool $content = true): string { $stub_path = config('crud.stub_path', 'default'); - if ($stub_path == 'default') { + if (blank($stub_path) || $stub_path == 'default') { $stub_path = __DIR__.'/../stubs/'; } diff --git a/src/CrudServiceProvider.php b/src/CrudServiceProvider.php index a047a3d..e18131f 100644 --- a/src/CrudServiceProvider.php +++ b/src/CrudServiceProvider.php @@ -26,6 +26,10 @@ public function boot() $this->publishes([ __DIR__.'/config/crud.php' => config_path('crud.php'), ], 'crud'); + + $this->publishes([ + __DIR__.'/../src/stubs' => resource_path('stubs/crud/'), + ], 'stubs-crud'); } /** diff --git a/src/config/crud.php b/src/config/crud.php index 9256201..4d8cb3b 100644 --- a/src/config/crud.php +++ b/src/config/crud.php @@ -11,19 +11,21 @@ | stubs paths here, allowing you to customize the own stubs of the | model,controller or view. Or, you may simply stick with the CrudGenerator defaults! | - | Example: 'stub_path' => resource_path('path/to/views/stubs/') + | Example: 'stub_path' => resource_path('stubs/') | Default: "default" | Files: | Controller.stub | Model.stub + | Request.stub | views/ - | create.stub - | edit.stub - | form.stub - | form-field.stub - | index.stub - | show.stub - | view-field.stub + | bootstrap/ + | create.stub + | edit.stub + | form.stub + | form-field.stub + | index.stub + | show.stub + | view-field.stub */ 'stub_path' => 'default', @@ -48,6 +50,8 @@ */ 'unwantedColumns' => [ 'id', + 'uuid', + 'ulid', 'password', 'email_verified_at', 'remember_token', @@ -59,6 +63,18 @@ 'controller' => [ 'namespace' => 'App\Http\Controllers', + 'apiNamespace' => 'App\Http\Controllers\Api', ], + 'resources' => [ + 'namespace' => 'App\Http\Resources', + ], + + 'livewire' => [ + 'namespace' => 'App\Livewire', + ], + + 'request' => [ + 'namespace' => 'App\Http\Requests', + ], ];