0

I'm using the LaravelCollective HTML module to add forms to some views. The problem is that the actions in the forms are being generated at HTTP urls instead of HTTPS. Is there a way to make it just use whatever protocol the page loads as without having to explicitly spell out each absolute URL in the form call? Here's an example of the form tag I'm using in a view:

{!! Form::model(Auth::user(),['route','step1.post']) !!}
LoneWolfPR
  • 3,978
  • 12
  • 48
  • 84

1 Answers1

1

The route helper function will generate the correct url (including http/https protocol) according to route names as defined in routes.php.

Try for instance

Route::post('/user', ['https', 'UserController@post'])->name('step1.post');

in routes.php, and then

{!! Form::model(Auth::user(), ['url' => route('step1.post')]) !!}

in your view.

alepeino
  • 9,551
  • 3
  • 28
  • 48
  • is 'https' an actual middleware? I can't find that in the documentation. – LoneWolfPR Mar 01 '16 at 18:50
  • I don't know exactly. I just tried Route::post('/user', ['https', 'UserController@post']) and it works as well. It must not be an actual middleware then. – alepeino Mar 01 '16 at 18:55
  • The documentation wasn't particularly great on this topic, agreed – alepeino Mar 01 '16 at 18:56
  • Got an error when using the middleware, but just putting 'https' in like you mentioned in your comment works. If you update your answer I'll mark it as correct. Thanks! – LoneWolfPR Mar 01 '16 at 21:35