Reputation: 9
I'm having problem with increment. I have query in model.
public function scopeViewCount($query)
{
return $query->increment('view', 1);
}
My controller.
public function quoteBySlug($slug)
{
$quote = Article::bySlug($slug);
if (! $quote) {
abort(404);
}
$quote->viewCount();
return view('pages/quote/quote-detailed')->with('quote', $quote);
}
Its working but problem is that its adding +2 some times even +4 but i need only +1 so what's i'm doing wrong?
Upvotes: 0
Views: 136