/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function home() { $data = []; $now = Carbon::now('UTC'); $data['daysUntil'] = $this->oscar->first()->ceremony_date->diffInDays($now); $data['movieCount'] = $this->movie->count(); $data['userCount'] = $this->user->count(); $data['mostWatched'] = $this->userMovie->pushCriteria(new MostWatched())->pushCriteria(new Limit15())->all(); $data['latest'] = $this->userMovie->pushCriteria(new Latest())->pushCriteria(new Limit15())->all(); return view('explore.home', $data); }
public function watch($movieid) { $already = $this->userMovie->pushCriteria(new AlreadyWatched($movieid, Auth::user()->userid))->all(); if ($already->count() > 0) { return redirect()->route('home'); } $data['movieid'] = $movieid; $data['userid'] = Auth::user()->userid; $this->userMovie->create($data); return redirect()->route('watchedList'); }