Hi Laravel friends!
Where to tell Artisan the right base url?
I use Laravel in a subfolder like http://mysuperserver/laravel/ When I call it from Browser all works fine, all generated urlss are right.
But if I use a custom Artisan command the generated url's are like http://mysuperserver/ without the subfolder.
in app/config/app.php I set the url but thats doesn't work.
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => 'http://mysuperserver/laravel/',
My custom command run a controller function -> a model -> get data from db -> back to controller -> make view -> in view -> {{ link_to_route('my.named.route') }}
From HTTP all generated url's = fine.
From Artisan generaded url's != fine.
Hi there! How did you set up your application environments under bootstrap/start.php ?
If your running on local environment you might have to create a seperate config file under app/config/local/app.php and set the Application URL for artisan right there.
I think you can even specifiy the env when running your artisan command like this
# php artisan some:task --env=local
hope that helps.
Hi all!
I'm having the same issue. Does somebody have a workaround?
Hi,
Encountered same issue. Also posted question here: http://stackoverflow.com/questions/25750604/laravel-artisan-gives-wrong-base-url
Moved past this using Config::get('app.url') instead.
Hope this helps!
Hi medowlock,
Thanks, I did the same workaround as you suggested, but would be good to have this corrected in future laravel versions.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community