Laravel generate secure https URL from route -
i can't find way generate secure url from route name.
to full url, use
echo route('my_route_name'); but do, if want url https?
update: pointed out in comments, simpler way of doing adding url::forceschema('https'); laravel version between 4.2-5.3 or url::forcescheme('https'); version 5.4+ in boot method of appserviceprovider file.
old answer:
it's entirely possible , there's 1 line of code needed accomplish that.
laravel doesn't check presence of ssl itself, depends on symfony. , there goes our key making believe current request secure.
the thing is, have set https server param true , easiest method paste following code in boot method of appserviceprovider:
$this->app['request']->server->set('https', true); in case, need force ssl in production, local env should still work on http. how force ssl on production:
$this->app['request']->server->set('https', $this->app->environment() != 'local'); by way, mind terms, may need them in future.
Comments
Post a Comment