homepage, new newsletter section, multilang support

This commit is contained in:
elvira committed 2026-08-08 14:50:10 +03:00
1 parent bf8b9219fc
commit e46276a31b
26 files changed
+1580 -547

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers;
use Lunar\Models\Product;
class HomeController extends Controller
{
public function index()
{
$products = Product::with(['variants.prices.currency', 'media'])
->inRandomOrder()
->limit(13)
->get()
->map(fn (Product $product) => [
'name' => $product->translateAttribute('name'),
'price' => $product->variants->first()?->prices->first()?->price->decimal,
'image' => $product->media->first()?->getUrl(),
'href' => route('product.show', ['product' => $product]),
]);
return view('home', [
'heroProducts' => $products->take(5)->values(),
'classicsProducts' => $products->slice(5)->values(),
]);
}
}