Laravel: HTTPS in Form::open()
Asked Answered
B

1

8

I'm using SSL for my website (Cloudflare HTTPS) in my login for weh I use ``, Laravel won't convert my website link to SSL version and it shows http version. How can I force Laravel to use https for me?

For example:

<?=Form::open(array('id' =>'submit'))?>

   . . .

<?=Form::close()?>

And the result will be:

<form method="POST" action="http://example.com" accept-charset="UTF-8" id="submit">

</form>

I want action to be a HTTPS link.

Blim answered 17/10, 2014 at 14:39 Comment(0)
F
10

If you want to use https you need to manually give path which will be set to action.

You need to use URL::to this way:

<?=Form::open(array('url' => URL::to('/', array(), true), 'id' =>'submit' ))?>

to make submit to / url (which will be equivalent to example.com) and pass as 3rd parameter true to make it secure

Francoise answered 17/10, 2014 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.