From 04a4bad3e8fb7afe7049eca3008669862652a1fa Mon Sep 17 00:00:00 2001 From: roman Date: Wed, 20 Nov 2024 17:48:34 +0600 Subject: [PATCH 1/2] feat: add property annotation refs: https://github.com/RonasIT/laravel-entity-generator/issues/103 --- src/Generators/ResourceGenerator.php | 3 ++- stubs/resource.blade.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Generators/ResourceGenerator.php b/src/Generators/ResourceGenerator.php index 4ac24cf2..f8ea5912 100644 --- a/src/Generators/ResourceGenerator.php +++ b/src/Generators/ResourceGenerator.php @@ -48,7 +48,8 @@ public function generateResource(): void $resourceContent = $this->getStub('resource', [ 'entity' => $this->model, - 'namespace' => $this->getOrCreateNamespace('resources') + 'namespace' => $this->getOrCreateNamespace('resources'), + 'model_namespace' => $this->getOrCreateNamespace('models'), ]); $this->saveClass('resources', "{$this->model}Resource", $resourceContent); diff --git a/stubs/resource.blade.php b/stubs/resource.blade.php index 88dac154..21399ecb 100644 --- a/stubs/resource.blade.php +++ b/stubs/resource.blade.php @@ -1,7 +1,11 @@ namespace {{$namespace}}; use Illuminate\Http\Resources\Json\JsonResource; +use {{$model_namespace}}\{{$entity}} +/** + *@property {{$entity}} $resource + */ class {{$entity}}Resource extends JsonResource { //TODO implement custom serialization logic or remove method redefining From d9d877e33eb39c91c01b6e9cdab464e73fc78188 Mon Sep 17 00:00:00 2001 From: roman Date: Wed, 20 Nov 2024 18:13:05 +0600 Subject: [PATCH 2/2] fix: add semicolon refs: https://github.com/RonasIT/laravel-entity-generator/issues/103 --- stubs/resource.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/resource.blade.php b/stubs/resource.blade.php index 21399ecb..87db1f18 100644 --- a/stubs/resource.blade.php +++ b/stubs/resource.blade.php @@ -1,7 +1,7 @@ namespace {{$namespace}}; use Illuminate\Http\Resources\Json\JsonResource; -use {{$model_namespace}}\{{$entity}} +use {{$model_namespace}}\{{$entity}}; /** *@property {{$entity}} $resource