Refactor and enhance codebase: remove unused docblocks, adjust product search limits, and improve Nova resource visibility based on user roles. Update middleware imports and streamline query return types for better clarity and maintainability.
This commit is contained in:
1 parent
5c17c35741
commit
550ffea5c0
11 files changed
+44
-33
No files matched your search
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Product\Search;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
class ProductMediaResourceJustThumb extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'thumbnail' => $this->getUrl('thumb288x431'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Product\Search;
|
||||
|
||||
use App\Http\Controllers\Api\V1\Product\Resources\ProductMediaResource;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Ecommerce\Product\Product\Product;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -37,7 +36,7 @@ public function index(Request $request): JsonResponse
|
||||
->where('products.parent_id', null)
|
||||
->where('products.stock', '>', 0);
|
||||
})
|
||||
->limit(40)
|
||||
->limit(12)
|
||||
->get();
|
||||
|
||||
return response()->rest(
|
||||
@@ -52,7 +51,7 @@ public function index(Request $request): JsonResponse
|
||||
'name' => $product->brand?->name,
|
||||
],
|
||||
'thumbnail' => $product->thumbnail(),
|
||||
'media' => ProductMediaResource::collection($product->media),
|
||||
'media' => ProductMediaResourceJustThumb::collection($product->media),
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user