N
N
Nuruzov2018-05-03 10:57:40
Laravel
Nuruzov, 2018-05-03 10:57:40

How to send data with form put method?

i have edit.blade.php template to edit post. I send it to the controller with this form
{!! Form::model($post, ['route' => ['posts.update', $post->id], 'method' => 'put']) !!}
must be sent using the put method. Tried writing hidden inputs with put method.
after I do submit just a white screen appears. In the console it says that it was poisoned by the post method.
function in the controller.
public function update(Request $request, $id)
Router like this
Route::resource('posts', 'PostController');
I am using laravel 5.4

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Wolf, 2018-05-03
@Wolfnsex

after I do submit just a white screen appears. In the console it says that it was poisoned by the post method.
In the browser, forms are submitted using either the "GET" or "POST" method. The rest of the behavior is "emulated" at the framework level. You can read more about how to specify the method by which the form is submitted in the Laravel documentation .

Y
Yan-s, 2018-05-03
@Yan-s

The console will not say PUT
https://laravel.com/docs/5.6/routing#form-method-s...
Make a POST request with
<input type="hidden" name="_method" value="PUT">

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question