@david001 have you tried {!! $data !! } on your view?
Mar 13, 2020
8
Level 5
How to unserialize data
I am developing an eCommerce application. I have store user order in Orders table where I have id/user_id/cart/create_at/updated_at
field
The data in the cart is serialized and as an admin I want to see which user_id or user
has purchased what products. I want to show this on the view page.
My method
public function userOrder(){
$orders = Order::get();
return $orders;
//return view('');
}
[
{
id: 5,
user_id: 3,
cart: "O:8:"App\Cart":3:{s:5:"items";a:2:{i:5;a:5:{s:2:"id";i:5;s:4:"name";s:11:"DELL LAPTOP";s:5:"price";s:3:"799";s:3:"qty";i:1;s:5:"image";s:60:"public/product/iPhZNz1Fy9dYxAawNtVOspXvpTWvc28nFMwDTG7a.jpeg";}i:6;a:5:{s:2:"id";i:6;s:4:"name";s:15:"Lenovo ThinkPad";s:5:"price";s:3:"777";s:3:"qty";i:1;s:5:"image";s:60:"public/product/xa6HX9dvWxo1ZT0lGebO8PtWmg8NKEauvJHC4PjX.jpeg";}}s:8:"totalQty";i:2;s:10:"totalPrice";i:1576;}",
created_at: "2020-03-12 11:21:06",
updated_at: "2020-03-12 11:21:06"
},
{
id: 6,
user_id: 3,
cart: "O:8:"App\Cart":3:{s:5:"items";a:2:{i:5;a:5:{s:2:"id";i:5;s:4:"name";s:11:"DELL LAPTOP";s:5:"price";s:3:"799";s:3:"qty";i:2;s:5:"image";s:60:"public/product/iPhZNz1Fy9dYxAawNtVOspXvpTWvc28nFMwDTG7a.jpeg";}i:1;a:5:{s:2:"id";i:1;s:4:"name";s:11:"HP LAPTOPS ";s:5:"price";s:3:"877";s:3:"qty";i:1;s:5:"image";s:53:"product/yyO8bETsNup8nECU8sF0d7VBeRVbkEiQWthswpHP.jpeg";}}s:8:"totalQty";i:3;s:10:"totalPrice";i:2475;}",
created_at: "2020-03-13 09:16:58",
updated_at: "2020-03-13 09:16:58"
}
]
Please help me to display this data in view page.
Please or to participate in this conversation.