Add new data in getBasket context

This commit is contained in:
Ludovic CANDELLIER
2022-04-24 23:20:52 +02:00
parent 5d68e8787a
commit 416c724ad1
5 changed files with 41 additions and 22 deletions

View File

@@ -47,10 +47,16 @@ class Offers
{
$basket = ShopCart::getContent();
// dump($basket->toArray());
$offers = Offer::with(['variation', 'article.article_nature', 'article.image'])->whereIn('id', ShopCart::keys())->get();
$offers = Offer::with([
'variation',
'article.article_nature',
'article.product.Specie',
'article.image',
])->whereIn('id', ShopCart::keys())->get();
foreach ($basket as $item) {
$offer = $offers->where('id', $item->id)->first();
dump($offer->toArray());
exit;
$article_nature = strtolower($offer->article->article_nature->name);
$data[$article_nature][] = [
'id' => (int) $item->id,