so I have this simple code to make another request and return the content:
//from https://github.com/SamuelDavis/laravel-helpers-subrequest
function subRequest($url){
$url = url($url);
$request = Request::create($url, 'get');
$dispatched = Route::dispatch($request);
return $dispatched->getContent();
}
and this two simple routes:
Route::get('/first', function () {
return subRequest('/second/1');
});
Route::get('/second/{id}', function () {
echo Route::current()->getUri();
echo Request::fullUrl();
return '';
});
what I want is when user will request "/first" he will get the second route url which is:
"/second/1"
right now I cant find a way to make it happen as the first echo is returining
/second/{id}
and the second echo :
http://1.1.1.1/first //(which is the first request url)
via Amir Bar