I am working on a project that requires a secure connection.
I can set the route, uri, asset to use \'https\' via:
Route::get(\'order/details/{id}\',
I would prefer forceScheme instead of doing it on a web server. So Laravel app should be responsible for it.
So right way is to add if statement inside boot function in your app/Providers/AppServiceProvider.php
if (env('APP_ENV') === 'production') {
\Illuminate\Support\Facades\URL::forceScheme('https');
}
Tip: to prove that you have APP_ENV configured correctly. Go to your Linux server, type env
This was tested on Laravel 5, specifically 5.6.