I'm making a adressbook app via laravel 5.2 and vuejs, my app needs CRUD functionality, i stuck at Update part, i send the data via ajax to laravel and i get the data in laravel but i cant update rows. this is my method in vuejs that handle updating:
updatecontact:function(){
var contactid = this.editingcontact.id;
var contact update = JSON.stringify(this.editingcontact);
this.$http({url: '/adressbook/'+contactid, data: {contactupdate} , method: 'PATCH'})
.then(function (response) {
console.log(response);
}, function (response) {
// error callback
});
and this the method that handles ajax request in laravel(it's a PUT)
public function update(Request $request, $id)
{
$adressbook = Adressbook::findorFail($id);
$adressbook->save($request->all());
}
at last this is how the data looks like:
contactupdate: "{"id":5,"companyName":"poolad","zamineKar":"test","tel":"44044440","fax":"44044422","email"}"