Trying to work with both VueJS and Laravel, I am currently facing an issue where I cannot retrieve a parameter value. Can anyone provide guidance on how to solve this problem?
This is my VueJS code:
getTestData:function () {
let config = {
params: {
id: 1
}
};
axios.post('{{ route('get_user_data') }}', config)
.then(function (response) {
console.log(response);
// app.posts=response.data;
})
.catch(error => {
})
},
Here is my Controller code:
public function testData(Request $request)
{
// Need help in retrieving this value
}
My route definition:
Route::post('get-user-data','TestController@testData')->name('get_user_data');