doucheng1944
doucheng1944
2016-11-16 01:15

如何在用户访问特定页面时更新页面匹配

  • laravel
  • php

I am using Laravel 5.2. How can I increment a hits field in articles table when a specific an article is visited by the user?

This is the code I came up with:

Article::where('id', 2)->increment('hits');

Where would be the best place to insert this code to?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐