framework: route() helper function does not work well in artisan commands

In Laravel 5.2.39, my app has

.env

APP_URL=http://dev.env/smartbots

config/app.php

'url' => env('APP_URL'),

app/Http/routes.php

Route::get('test', function () {
    dd(route('twilioVoiceRequest'));
});

Route::get('/twilio-voice-request', function() {
})->name('twilioVoiceRequest');

Artisan command (twilio:setup)

public function handle()
{
    dd(route('twilioVoiceRequest'));
}

This is what i got from test route untitled

and from php artisan twilio:setup untitled2

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 28 (19 by maintainers)

Commits related to this issue

Most upvoted comments

We definitely don’t recommend you run apps on sub-folders though.

route() helper use toRoute() and getRouteDomain() https://github.com/laravel/framework/blob/5.2/src/Illuminate/Routing/UrlGenerator.php#L324

Is this a bug?

I can’t say for homestead… Let’s reference issue #17385 you have just created 😃