In my AngularJS Service I have an array of id's which I want to pass to a PHP server so it can delete them but somehow I keep on getting a 500/Internal Server Error response.
In my server log it's saying that the request is missing one argument which means the passing to the server wasn't successful.
I have something like this in my service:
destroySelected : function (ids) {
// console.log(ids);
// return $http.delete('/posts/destroySelected', ids);
return $http({
method: 'DELETE',
url: '/posts/destroySelected/',
headers: {'Content-Type': 'application/json;charset=utf-8'},
data: {ids : ids}
});
}
For my php controller I have this:
public function destroySelected($ids) {
echo "<pre>" . var_export($ids, true) . "<pre>";
die;
return response()->json(Post::get());
}
my route:
Route::delete('posts/destroySelected/', 'PostController@destroySelected');
It's empty, but I wanted to double check that it's being passed successfully before I do anything else.
Can someone tell me what's going wrong here?