Search code examples
phplaravel-5laravelcollective

Laravel collectivehtml secure route or url


in my view page I have this route:

{!! Form::open(['url' => 'forumcomment/' . $forum->slug, 'files'=>false, 'id' => 'qw-commentform' ,'class' => 'qt-clearfix'])   !!}

        <hr class="qt-spacer-s"><div class="input-field">
        {!! Form::textarea('comment', null, ['class'=>'materialize-textarea', 'id'=>'my-editor', 'required'=>'required','aria-required'=>true]) !!}
        <label for="comment" class="">Comment*</label></div>
        <hr class="qt-spacer-s">
      {!! Form::submit('Post Comment', array( 'class'=>'qt-btn qt-btn-primary qt-btn-xl' )) !!}
    {!! Form::close() !!}

getting mixed content error How can I get a secure route?


Solution

  • add this to the boot method of your AppServiceProvider. This loads all content over http on local development and https on production

    $this->app['request']->server->set('HTTPS', $this->app->environment() != 'local');
    

    and always change your environment to production on production.