Laravel enable https

18 Sep

In Laravel there are two way to make asset use https protocol.
Open the file app/Providers/AppServiceProvider.php.

Add these two lines at the top of file

use URL;
use Illuminate\Support\Facades\App;

And paste the below code in boot method.

if (App::environment() === 'production') {
URL::forceScheme('https');
}

Now open .evn file and change the value of parameter APP_ENV=local
to APP_ENV=production.
keep APP_ENV=local and you local server and change the value on production server to APP_ENV=production.

or you can use secure_asset in each call instead of asset.

Both will works.



Leave a Reply

Your email address will not be published. Required fields are marked *

11 + one =