Answer the question
In order to leave comments, you need to log in
How to call the controller from the route function?
Route::get('{url_1}/{url_2?}/{url_3?}', function ($url_1, $url_2 = null, $url_3 = null) {
//Действия, как тут при нужно условии вызвать нужный контроллер?
}
Answer the question
In order to leave comments, you need to log in
Route::get('{url_1}/{url_2?}/{url_3?}', ['uses' => '[email protected]']);
// Your controller
public function method ($url_1, $url_2 = null, $url_3 = null) {
//Действия
}
If you use a closure function, then it is already your controller. If you have some actions in some controller and you want to use the same actions in routes, then this already turns out to be business logic and you need to put it in a separate class. What you're trying to do is wrong
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question