Пример #1
0
 /**
  * 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);
 }
Пример #2
0
 public function search($text = null)
 {
     $search = $text ?: $this->request->input('query');
     $movie = $this->movie->pushCriteria(new Search($search))->all();
     if ($movie->count() < 1) {
         return redirect()->route('home');
     }
     if ($movie->count() == 1) {
         return redirect()->route('movieShow', $movie->first()->movieid);
     }
     $data['movies'] = $movie;
     $data['actions'] = false;
     $data['title'] = "Search: {$search}";
     return view('movie.all', $data);
 }