Nikki
215
6
Laravel

Can't unserialize my address

Posted 3 months ago by Nikki

I serialized my address so that I could have it saved to a table in one go, but now when I try to unserialize it I get this error

unserialize(): Error at offset 40 of 1597 bytes

I'm not sure if I'm doing anything wrong

Here is my code

public function orderDetails($invoice_number)
    {
        $menus_child = Menu::where('menu_id', 0)->with('menusP')->get();
        $contacts = Contact::all();

        $orders = Order::where('invoice_number', $invoice_number)->get();

        $user_id = Auth::user()->id;

        foreach($orders as $order)
        {
            $order_address = $order->address;

            $address = unserialize($order_address);
        }

        dd($address);
        return view('public.users.order-details', compact('menus_child', 'contacts', 'orders', 'addresses'));
    }

Please sign in or create an account to participate in this conversation.