mardi 28 mars 2017

Laravel form submit with vue

New to Laravel and vue.

I have a vue script that builds a table. In each row I have a button that is suppose to submit a form and set the status field to: 2.

The form code:

<form @submit.prevent="submitForm" class="status-form" action="'/orders/' + row.Id" method="post">
    
    <input type="hidden" name="status" value="2">
    <button type="submit" class="btn btn-success btn-sm">Sent</button>
 </form>

If I don't put in the code, everything works fine. If I do, the rows are not populated in the table.

I tried: @ and {!! csrf_field !!} as well, same results.

How do I add this field?

And then, if someone can help and give me the code to actually submit the form?

Another question: Do I need a special route for it or can I use the resource route?

I read lots of posts on google, but very confused and can't find the way to do it.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire