In my app's bootstrap code I need to use $_SERVER['HTTP_HOST']
to do some initialization.
Problem is when I run php artisan routes
on the command line it has no idea where the request is from and this throws an undefined index error. Same thing when using Request::server('HTTP_HOST')
of course.
Any way to deal with this?
the problem is generating routes anchors?
maybe this helps (route and url) route with named routes
generate absolute url including host
http://laravel.com/docs/helpers#urls
http://laravel.com/docs/routing#named-routes
example:
Route::get('test', array('as' => 'test', 'uses' => 'TestController@test'));
in views:
<a href="{{ route('test') }}"> Test </a>
Sorry, the issue is with executing the php artisan routes
command
$_SERVER['HTTP_HOST'] is not set when you ru comands from cli
Where do you get an error? File?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community