Getting an error when im trying delete users in my table.
My Route(api.php)
Route::delete('/users/{id}', 'UsersController@destroy');
My Controller
public function destroy($id) { $user = UserModel::findOrFail($id); $user->delete(); return new UsersCollection($user); }
My Vue.js
remove(id) { let $this = this; axios.delete(`/api/users/${id}`).then(function(response) { $this.fetchUser(); }) },
Any Help will be appreciate... Thanks in advances.
findOrFail
is to return a 404 when the entity is not found, it is working correctly. – atymic