laravel сеансовый ключ для группового - PullRequest
0 голосов
/ 15 февраля 2020

Привет! Мне нужна $ clave сессии, чтобы я мог удалить сессию. Как я могу это сделать? Спасибо

$carrito=Session::get('cart');

$grouped = Session::get('cart')->groupBy('vendedor');

foreach($carrito as $clave => $carro) {
    echo $clave ; //I need to put these keys in the <a> to be able to delete the session of that item because when applying groupby it does not give me the session key. 
}

@foreach($grouped as $id => $value)
    @foreach($value as $key => $cartItem)
        <a href="#" onclick="removeFromCartView(event, {{ $clave}})" class="text-right pl-4"><i class="la la-trash"></i></a>
    @endforeach
@endforeach

1 Ответ

0 голосов
/ 16 февраля 2020

Я решил с помощью ->groupBy('vendedor', $preserveKeys = true)

Ответ @Carlos в комментариях

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...