Home > Software design >  where is forceScheme function y laravel
where is forceScheme function y laravel

Time:04-01

I want to work in https app I cant geerate https links whit "url" blade function in some ask question say have use this, but, not works

\Illuminate\Support\Facades\URL::forceScheme('https');

CodePudding user response:

after read manual found...

Use the function secure_url() from laravel 5.2 and new versions

$url = secure_url('user/profile');

{{ secure_url('your-link') }} //instead url()

reference laravel secure_url() function

CodePudding user response:

in app/Providers/AppServiceProvider

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\URL;

class AppServiceProvider extends ServiceProvider
{
/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    //
}

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    URL::forceScheme('https');
}
}

update your AppServiceProvider accordingly and every url will be forced to https

  • Related