skip to Main Content

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

IlluminateSupportFacadesURL::forceScheme('https');

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. in app/Providers/AppServiceProvider

    <?php
    
    namespace AppProviders;
    
    use IlluminateSupportServiceProvider;
    use IlluminateSupportFacadesURL;
    
    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search