//Vuejs2 //Laravel v7.x
I turn to you because I'm blocking, I can't find a solution. I want to recover the data in my object in my controller. In my View.vue I make an axios post
data() {
return {
customer: {
name: 'abc',
login: 'def'
},
file: null
}
},methods: {
submit(){
let formData = new FormData();
formData.append("customer", this.customer);
formData.append("file", this.file);
axios.post('/project/new',
formData, {
headers: {
"Content-Type": "multipart/form-data"
}
}).then(data => {
console.log(data.data);
});
}
}
I collect like that in my controller
public function postProject(Request $request)
{
return $request->customer; //return [Object Object]
return $request->customer->name; //return Trying to get property 'name' of non-object
return $request->customer['name']; //return Illegal string offset 'name'
return $request->file; //return [Object Object]
}
Thx for help. have a nice day.