I keep getting an internal Server Error 500 (TokenMismatchException) when doing an update from angularjs.
angular function:
vm.eventSaved = function(event) {
$http.put('/api/events/' + event.eventid, vm.event).success(function(eventsuccess){
}).error(function(err){ });
};
Values passed through vm.event
{
"events":
{
"_token": "xGD7kTETgmBytf8exwIUYHYEC6lKcPek9NCuz6Xh",
"eventid": "37",
"title": "Events",
"type": "info",
"startsAt": "2015-08-15T10:46:00+00:00",
"endsAt": "2015-08-15T11:46:00+00:00",
"draggable": "true",
"resizable": "true"
}
}
Laravel controller function:
public function update($id, AppointmentsRequest $request)
{
$appointments = Appointment::findOrFail($id);
$appointments->update($request->all());
return Response::json(array('success'=>true));
}
Is there something I should add to my Laravel controller to handle this? I do practically the same thing with a "delete" and I don't get this error.