Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: HTTPS in Form::open()

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.

like image 836
Sky Avatar asked Oct 17 '14 14:10

Sky


1 Answers

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

like image 185
Marcin Nabiałek Avatar answered Nov 18 '22 03:11

Marcin Nabiałek