generated from boboko/starter
Feat: Updating Product imports after Boboko restructure
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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) => [
|
||||
|
||||
Reference in New Issue
Block a user