I have such a situation. I have a form in which I need to get an id, and then with this id make a request to the database.
Here is the html code:
<form action="/product/get" method="post"> <div style="margin-top: 15%;" class="input-group mb-3"> <div class="input-group-prepend col-xs-12"> <span style="color: white;" class="input-group-text bg-dark" id="basic-addon1">Введите Id: </span> </div> <input type="text" name="name" class="form-control" aria-describedby="basic-addon1"> </div> <input type="submit" class="btn btn-success container" value="Получить товар" > </form> and this is a controller
public function postId(Request $request){ $id = $request->input('name'); $product = Product::where('id', $id)->get(); return view('showProduct', ['product' => $product]); } and this is the way:
Route::post('/product/get','ProductController@postId' ); When I press the button, error 419 is displayed (Sorry, your session has expired.)