We can load method in another controller without changing the url using Laravel.
If you are using Laravel 3 then we will define:
Controller::call('ApplesController@getSomething');
If We are using Larval 4.x then we will define:
$request = Request::create('/apples', 'GET', array());
return Route::dispatch($request)->getContent();
In this case, you have to define a route for ApplesController, something like this
Route::get('/apples', 'ApplesController@getSomething'); // in routes.php
In the array() you can pass arguments if required.
By this way we will load method in another controller without changing the url using Laravel 4.x
0 Comment(s)