vendredi 29 octobre 2021

laravel 5.8 form::model not working, Post form is sent as Get

I have an error in one of my forms, all the others work but in particular I cannot edit in this one since it does not send the post from a form created with Form :: model (), it took me a while to realize that this was the problem, although I have defined the form as POST the data is sent as GET and it does not find the route since it is defined as POST.

This is my failed code:

{!! Form::model($nota, [
'method' => 'POST',
'url' => ['/admin/notas', $nota->id],
'class' => 'form-horizontal',
'files' => true]) !!}

@include('admin.notas.form', ['formMode' => 'edit'])

{!! Form::close() !!}

But later I realized that if I copy the html generated by this code and paste it raw, there it works!

<form method="POST" action="https://mydomain/admin/notas/" accept-charset="UTF-8" class="form-horizontal" enctype="multipart/form-data">
@csrf

@include('admin.notas.form', ['formMode' => 'edit'])
</form>

It is worth mentioning that this form allowed to edit correctly beforehand, and that in localhost (WAMP) it works correctly, I already confirmed that my model, controller and routes are fine, but everything fails from the submit and does not reach the route defined as Post because it is sent as Get.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3mlsAxb
via IFTTT

Aucun commentaire:

Enregistrer un commentaire