I want to get the current domain, using Request::server('HTTP_HOST') - however when I call this from within a helper class it comes back as 'localhost' which is not what I want. From a controller it works as expected. Is there a way to access this information from within a helper class?
The helper class looks like this:
class ApiWrapper {
public static function call($model, $method='', array $input) {
$domain = Request::server('HTTP_HOST');
}
}
You can do URL::to('/')
to get the base URL of the Laravel application, if that's what you're asking for. If doing Request::server('HTTP_HOST')
from your controller is giving you the desired result, doing the same from the helper class shouldn't be any different.