diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php index e6f8912..2fc2227 100644 --- a/app/Http/Controllers/CategoryController.php +++ b/app/Http/Controllers/CategoryController.php @@ -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( diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index fd4e0db..14a0b27 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -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) => [ diff --git a/config/core.php b/config/core.php index e56303c..5e0f027 100644 --- a/config/core.php +++ b/config/core.php @@ -16,20 +16,4 @@ 'auto_create_customer_for_user' => true, - /* - |-------------------------------------------------------------------------- - | Product Option Types - |-------------------------------------------------------------------------- - | - | Enabled `Modules\Core\Product\Contracts\ProductOptionTypeInterface` - | implementations. An admin picks one per ProductOption from a dropdown - | on the option's own edit form — the selection is stored in - | ProductOption::meta, not tied to the option's handle. - | - */ - - 'product_option_types' => [ - \Modules\Core\Product\OptionTypes\ColorOptionType::class, - ], - ]; diff --git a/config/lunar/search.php b/config/lunar/search.php index 324b572..e885456 100644 --- a/config/lunar/search.php +++ b/config/lunar/search.php @@ -46,10 +46,10 @@ 'indexers' => [ Lunar\Models\Brand::class => Lunar\Search\BrandIndexer::class, - Lunar\Models\Collection::class => Lunar\Search\CollectionIndexer::class, + Lunar\Models\Collection::class => Modules\Core\Catalog\Services\CollectionIndexer::class, Lunar\Models\Customer::class => Lunar\Search\CustomerIndexer::class, Lunar\Models\Order::class => Lunar\Search\OrderIndexer::class, - Lunar\Models\Product::class => Modules\Core\Product\Services\ProductIndexer::class, + Lunar\Models\Product::class => Modules\Core\Catalog\Services\ProductIndexer::class, Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class, ], diff --git a/resources/views/components/ui/color-swatch.blade.php b/resources/views/components/ui/color-swatch.blade.php index fb00cf7..c9b171b 100644 --- a/resources/views/components/ui/color-swatch.blade.php +++ b/resources/views/components/ui/color-swatch.blade.php @@ -1,6 +1,6 @@ -{{-- $variants: array of Modules\Core\Product\Services\ProductIndexer's mapVariant() +{{-- $variants: array of Modules\Core\Catalog\Services\ProductIndexer's mapVariant() shape (id, options: [{option, value, meta}], ...) — plain arrays, not Eloquent - models, since this is fed from Modules\Core\Product\Services\ProductService. --}} + models, since this is fed from Modules\Core\Catalog\Services\ProductService. --}} @props(['variants', 'option' => null])
@@ -181,7 +181,7 @@ class="absolute bottom-6 right-8 text-white text-sm"