In my project using Laravel 5.8 and Vue.js 2, I have encountered a problem with the .vue file:
let formData = new FormData();
formData.append('name', this.name);
formData.append('image',this.image)
formData.append('_method', 'PATCH');
axios.patch('/url/' + this.id, formData)
.then(({data}) => {
})
.catch((error) => {
});
Route
Route::patch('/url/{id}', 'CarsController@update');
Error
I am receiving an error message: Integrity constraint violation: 1048 Column 'name' cannot be null.
Interestingly, when I change the method to POST in both my vue file and web.php, it seems to work fine. However, I need to use both methods - POST for new data and PATCH for updating existing data. How can I resolve this issue?