0👍
There’s no need to add params in URL since it’s POST request. You should use API routes (api.php) in Laravel and could structure it like this
Route::POST('/vote', 'QuestionController@vote');
Since you place it in api.php as API route, it would be prefixed with /api.
So you axios call should look like this:
addVote(id) {
axios.post(`/api/vote`, {id: id});
}
Now in your vote method of QuestionController would look like this:
public function vote(Request $request)
{
dd($request);
}
You will see dump of request data and decide what to do with it.
- [Vuejs]-How to use the vue-countdown-timer package in your Vue JS project
- [Vuejs]-How to import store to the Api layer? Got Webpack error
Source:stackexchange.com