eloquent - Laravel 5 : Incrementing by 2 instead by 1 -
i have field named viewed represents count of page displayed.
in controller have method :
public function getmedia($slug) { $media = media::where('slug', $slug)->first(); $media->viewed += 1; $media->save(); return view('medias.view', compact('media')); }
the problem page incremented 2 instead one. strange thing when have 49 displayed in database there 50..
thanx help
Comments
Post a Comment