/** * Bootstrap any application services. */ public function boot() { Trick::observe(TrickObserver::class); }
/** * Increment the view count on the given trick. * * @param \App\Trick $trick * * @return \App\Trick */ public function incrementViews(Trick $trick) { $trick->view_cache = $trick->view_cache + 1; $trick->save(); return $trick; }