Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

untymage's avatar

Calling routes internally

I want to call my routes internally:

Route::get('/video', function (){
	return 'some code';
})->name('test');

ExampleTest.php :

\Illuminate\Support\Facades\Http::get(route('test'));

But it not working:

Illuminate\Http\Client\ConnectionException : cURL error 7: Failed to connect to 127.0.0.1 port 8000: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)

0 likes
3 replies
shez1983's avatar
shez1983
Best Answer
Level 23

you can call the controller method directly do that. are you using a special port locally when browsing via a browser ie 8080 or something?

untymage's avatar

Nevermind turned out it should be within a controller

Please or to participate in this conversation.