I
I
IdontRememberMyNickName2020-05-08 18:24:21
Laravel
IdontRememberMyNickName, 2020-05-08 18:24:21

Doesn't load content when redirecting?

Good afternoon!
Faced such a problem, it is necessary to make a check in the middleware and if it passes, then redirect to the page.
$order = UserOrder::where('user_id', Auth::id())->first();

if($order->order_id == null){
return $next($request);
}
if($order->order_id != null and route('order.order-step', $order->order_id) != URL::current()){
return redirect()->route('orders.order -step', [$user->order_id]);
}elseif(route('orders.test-step', $user->order_id) == URL::current()){
return $next($request);
}
The check works, but when redirecting, the content is not loaded, the status code is 200, but the view is not loaded, it doesn’t even get into the controller, I will be grateful for any help)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bubaley, 2020-05-10
@bubaley

The first parameter of the route() function must be the named route. I understand you are trying to give view. Try passing the url.
https://laravel.ru/docs/v5/redirects
https://laravel.com/docs/7.x/redirects#redirecting...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question