I'm save my cart products as unserialized data from my cart session.

$order = new Order();

```
$order->cart = serialize($cart);
$order->code = strtoupper(str_random(15));
$order->user_id = Auth::user()->id;

$order->save();

```

now i need to unserialize the data to use it in my blade file, this is the function i'm using

```
$orders = Order::with('user')->findOrFail($order->id);

        $orders->transform(function($order, $key){

            $order->cart = unserialize($order->cart);

            return $order;

        });

        dd($orders);

```

I'm getting this error

> 
> BadMethodCallException Call to undefined method App\Order::transform()
> 
> 
> 

what seems to be the problem? and how can i unserialize my data;

any ideas ???