20-02-2026
This commit is contained in:
parent
854ce02bf6
commit
4d6b4930b2
128 changed files with 18247 additions and 2093 deletions
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\ProductStatus;
|
||||
use App\Models\Partner;
|
||||
use App\Models\Product;
|
||||
use App\Models\User;
|
||||
use App\Models\RegistrationCode;
|
||||
use App\Helpers\ThemeHelper;
|
||||
|
|
@ -189,8 +191,32 @@ new class extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
// Top-Angebote laden (Platzhalter - später aus Product-Tabelle)
|
||||
$this->topOffers = [
|
||||
// Top-Angebote aus dem Hub des Kunden laden
|
||||
$hubId = $partner->hub_id ?? $user->hub_id;
|
||||
$this->topOffers = Product::query()
|
||||
->where('status', ProductStatus::Active)
|
||||
->where('is_curated', true)
|
||||
->where('is_available', true)
|
||||
->when($hubId, fn ($q) => $q->where('hub_id', $hubId))
|
||||
->with(['categories', 'media'])
|
||||
->latest()
|
||||
->take(3)
|
||||
->get()
|
||||
->map(fn (Product $p) => [
|
||||
'id' => $p->id,
|
||||
'name' => $p->name,
|
||||
'description' => $p->description_short ?? '',
|
||||
'price' => $p->price ?? 0,
|
||||
'original_price' => $p->price ?? 0,
|
||||
'discount' => 0,
|
||||
'image' => $p->media->first()?->url ?? null,
|
||||
'category' => $p->categories->first()?->name ?? '',
|
||||
])
|
||||
->toArray();
|
||||
|
||||
// Fallback: Dummy-Daten wenn noch keine Produkte vorhanden
|
||||
if (empty($this->topOffers)) {
|
||||
$this->topOffers = [
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'Designer Sofa "Luna"',
|
||||
|
|
@ -198,7 +224,7 @@ new class extends Component {
|
|||
'price' => 1899.00,
|
||||
'original_price' => 2499.00,
|
||||
'discount' => 24,
|
||||
'image' => 'https://images.unsplash.com/photo-1555041469-a586c61ea9bc?w=400&h=300&fit=crop',
|
||||
'image' => null,
|
||||
'category' => 'Wohnzimmer',
|
||||
],
|
||||
[
|
||||
|
|
@ -208,7 +234,7 @@ new class extends Component {
|
|||
'price' => 899.00,
|
||||
'original_price' => 1299.00,
|
||||
'discount' => 31,
|
||||
'image' => 'https://images.unsplash.com/photo-1617806118233-18e1de247200?w=400&h=300&fit=crop',
|
||||
'image' => null,
|
||||
'category' => 'Esszimmer',
|
||||
],
|
||||
[
|
||||
|
|
@ -218,10 +244,11 @@ new class extends Component {
|
|||
'price' => 1599.00,
|
||||
'original_price' => 2199.00,
|
||||
'discount' => 27,
|
||||
'image' => 'https://images.unsplash.com/photo-1505693416388-ac5ce068fe85?w=400&h=300&fit=crop',
|
||||
'image' => null,
|
||||
'category' => 'Schlafzimmer',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue