Quimmo
Quimmo

Reputation: 65

How to create nested array in laravel sessions?

I'm trying to set nested array in sessions using laravel methods.

So i need to get something like this

$_SESSION['order'][$productId] = array();

Is it possible to do with laravel built-in methods?

Upvotes: 2

Views: 763

Answers (1)

krasipenkov
krasipenkov

Reputation: 2029

There is a little dirty way of achieving this:

$sessionData = Session->get('parentKey')

Than do some processing of data and add nested data to it, then do:

Session->put('parentKey', $sessionData)

I hope it is helpful for you.

Upvotes: 1

Related Questions