you can try this approach
in your mount event register this function
mounted() {
this.view();
},
methods: {
view() {
axios.get('/home/food_view/' + this.$route.params.id).then((response) => {
if (response.data.error)
Toast.fire({
icon: 'error',
title: response.data.error,
})
});
},
}
and in your migration create a column
$table->integer('view')->default(0);
and then in your controller do something like that
$model = Model::find($id);
$model->view += 1;
$model->save();
update you can use these route in route.js
{
path: '/food_details/:id/:slug',
name: 'food_details',
component: foodDetails
},