https is a secure url and we know google give first priority to search that use https. So if you have using http only from scratch and if you install ssl certificate then your website will open with https.
So, As we know, If you open with http url then all the links of page will generate with http from route. But if you want to force generate https link from route then you can do it. you can generate https link from route using URL::forceSchema('https').
We have to just force generate https link using "URL::forceSchema('https')" helper in AppServiceProvider.
app/Providers/AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use URL;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
URL::forceSchema('https');
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
Now you can just check it.
I hope you found your best.....
Do you like below Tutorials ?
- PHP Laravel 5.5 - import export data into excel and csv using maatwebsite
- Laravel 7.x and 6.x create custom facade example from scratch
- Node JS - Get Real time online users counter using socket io example
- PHP Laravel 7.x and 6.x - Bootstrap Admin Theme Integration example from scratch
- MySQL Query - How to select records of today to next Sunday ?
- Laravel 7.x and 6.x - username custom validation example
- Laravel 5.5 - Import Extract zip file using chumper/zipper package
- PHP Laravel Set Custom Validation Error Messages Example