Hello , i have a lot of query results some from elequent and others from DB::Table .
i want to store the results in sessions , but also when i retrive that data it's useful to filter it with collection helpers.
so i store the data as it is from elequent or from DB:: without convert to json or array .
do i have to format this data to json or array and decode it again and convert to collection to use collection helpers .
is it wrong to store the data as it s without convert it.
Thanks
You can store the data directly inside the session as it is. Laravel will automatically serialize and deserialize it for you when storing it in the session.
Another solid solution is storing DTO's in the session (Data transfer object). This way you always know what kind of object you have stored in the session.