C
C
chelkaz2017-04-03 23:39:13
Laravel
chelkaz, 2017-04-03 23:39:13

Laravel route name function over https, how to do in view?

In the form, in the view, I display the router on the post link:

<form method="POST" action="{{route('additem', ['id' => $loc->id])}}">

But in the end, the browser swears that I'm using a non-secure protocol via http
But I need https.
In the source code, I see that the link is obtained http://site.com/catalog/id/additem
A needed https://site.com/catalog/id/additem
B .env APP_URL=https://site.comWorth as needed.
The whole site works with a secure protocol perfectly. But to output through the route function , only the url with http is obtained , and not with https
. What's the problem?
The router itself:
Route::post('catalog/{id}/additem', '[email protected]')->name('additem')->where('id', '[0-9]+');

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
chelkaz, 2017-04-04
@chelkaz

There are a lot of crutches in the network and for some reason no one writes about the third parameter in the route function In the function, the 3rd parameter by default is true , which says to take into account the root url. In this case, to create a url in the form, you need to add false to the third parameters. As a result, the url with the default protocol of the page is displayed in the view.

A
Alexander Aksentiev, 2017-04-03
@Sanasol

secure_url

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question