Answer the question
In order to leave comments, you need to log in
How to make routing to FirstContoller for domain1.ru and SecondContoller for domain2.ru in Laravel?
Hello!
I already raised this topic here: Serving two domains with one Laravel at the same time (multisiting) - how to do it? from a slightly different angle, and it seemed that a solution was found, but it was not found.
Yes, you can get the domain name inside the controller using Route::domain in the route. But how to do this while still in the routing process?
Of course, I can write a function in the controller that will deal with routing)) but this will destroy all the holiness of MVC, which we pray for))
Please help (who knows how) to make routing to FirstContoller for domain1.ru and SecondContoller for domain2.ru .
Thank you.
PS The question is complicated by the fact that I, for some reason, cannot get access to $_REQUEST from the /routes/web.php file, in which, in theory, there should be a domain name (I thought to resolve it in simple PHP) - dd($_REQUEST) displays [ ] and that's it.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question