Answer the question
In order to leave comments, you need to log in
There is a route with parameters, you need to make a redirect if there are no parameters, how?
Hello everyone
Such a question is a route
Route::get('portfolio/cat/{alias?}',['uses' => 'Portfolio\[email protected]', 'as'=>'portfolioCat'])
Answer the question
In order to leave comments, you need to log in
Make a check and register a redirect directly in the route. And for good to make middleware
In the controller method, write the following:
if ($request->route("alias") === null) {
return redirect()->route("route name");
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question