Created
July 8, 2016 18:44
-
-
Save alex-oliveira/0d8e854e6e4d417fe337c768b28e8997 to your computer and use it in GitHub Desktop.
Internal Resquest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$input = Request::input(); | |
$request = clone app('request'); | |
$route = clone app('Illuminate\Routing\Route'); | |
$router = clone app('router'); | |
$internal = Request::create(route('action1'), 'GET', ['alex' => 'oliveira']); | |
Request::replace($internal->input()); | |
$dispatch = Route::dispatch($internal); | |
$response = method_exists($dispatch, 'getOriginalContent') ? $dispatch->getOriginalContent() : $dispatch->getContent(); | |
app()->instance('router', $router); | |
app()->instance('Illuminate\Routing\Route', $route); | |
app()->instance('request', $request); | |
Request::replace($input); | |
dump(Route::getCurrentRoute()->getName()); | |
dump(app('router')->getCurrentRoute()->getName()); | |
return $response; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment