Nikki
123
1
Laravel

Returning a view instead of a route

Posted 3 months ago by Nikki

I've created a form using vue. The problem I'm having is that after the form is submitted it needs to go to another page and the problem is that I need to have it return a view() instead of a redirect.

So for example if I submit in vue then in my controller function I would have this

return ['redirect' => route('product.shoppingCart', ['products' => $cart->items, 'totalPrice' => $cart->totalPrice, 'menus_child' => $menus_child, 'contacts' => $contacts, 'supplier_code' => $supplier_code])];

and that would work, except for that all the items I need to pass through doesn't work.

but if I submited the form using this

return view('public.shopping-cart', ['products' => $cart->items, 'totalPrice' => $cart->totalPrice, 'menus_child' => $menus_child, 'contacts' => $contacts, 'supplier_code' => $supplier_code])->render();

I just get sent to the product page, but with a blank page.

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