Feat: Updating Product imports after Boboko restructure

This commit is contained in:
2026-08-27 11:46:33 +03:00
parent 86c645fb36
commit defe1dab12
6 changed files with 14 additions and 31 deletions
+3 -3
View File
@@ -3,8 +3,8 @@
namespace App\Http\Controllers;
use Lunar\Models\Collection;
use Modules\Core\Product\DTOs\ProductFilters;
use Modules\Core\Product\Services\ProductService;
use Modules\Core\Catalog\DTOs\ProductFilters;
use Modules\Core\Catalog\Services\ProductService;
class CategoryController extends Controller
{
@@ -18,7 +18,7 @@ public function show(string $locale, Collection $collection)
$page = (int) request('page', 1);
// Listing/filtering reads from the Meilisearch index via ProductService,
// not Eloquent — see Modules\Core\Product\Services\ProductService. list() returns a
// not Eloquent — see Modules\Core\Catalog\Services\ProductService. list() returns a
// real LengthAwarePaginator of plain arrays (already localized/flattened),
// not Product models.
$products = $this->products->list(
+2 -3
View File
@@ -4,7 +4,7 @@
use Illuminate\Http\Response;
use Lunar\Models\Collection;
use Modules\Core\Product\Services\ProductService;
use Modules\Core\Catalog\Services\ProductService;
class ProductController extends Controller
{
@@ -13,11 +13,10 @@ public function __construct(private readonly ProductService $products) {}
public function show(string $locale, int $id)
{
$product = $this->products->getById($id);
abort_if($product === null, Response::HTTP_NOT_FOUND);
$collection = $product['collections'][0] ?? null;
$collectionModel = $collection !== null ? Collection::find($collection) : null;
$collectionModel = $collection !== null ? Collection::find($collection['id']) : null;
$variantsData = collect($product['variants'])
->map(fn (array $variant) => [