/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $shows = Show::orderBy('post_date', 'DESC')->simplePaginate(5);
     // DATES
     $today = Carbon::today()->formatLocalized('%A %B %d');
     $yesterday = Carbon::now()->subDay()->formatLocalized('%A %B %d');
     return view('shows')->with(compact('shows', 'today', 'yesterday'));
 }
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $shows = Show::orderBy('post_date', 'DESC')->limit(3)->get();
     $shows = $shows->reverse();
     // DATES
     $today = Carbon::today()->formatLocalized('%A %B %d');
     $yesterday = Carbon::now()->subDay()->formatLocalized('%A %B %d');
     return view('home')->with(compact('shows', 'today', 'yesterday'));
 }
 /**
  * Show all Shows
  *
  * Get a JSON representation of all the registered users.
  *
  * @Get("/") 
  */
 public function index()
 {
     $user = Auth::user();
     $id = $user->id;
     $show = Show::with('genres')->with('seasons')->with(['seasons.users' => function ($query) use($id) {
         $query->where('user_id', $id);
     }])->orderby('status', 'asc')->orderby('show_name', 'asc')->get();
     return $this->response->array($show->toArray());
 }
 private function getSickBeardShows()
 {
     $client = new Client(['base_uri' => 'http://' . getenv('POMPONG_SIKBEARD_ADDRESS') . '/api/' . getenv('POMPONG_SICKBEARD_APIKEY') . '/']);
     $response = $client->request('GET', 'shows');
     $data = json_decode($response->getBody(), true);
     foreach ($data['data'] as $value) {
         $response = $client->request('GET', '?cmd=show&tvdbid=' . $value['tvdbid']);
         $showData = json_decode($response->getBody(), true);
         echo "Updating " . $value['show_name'] . "\r\n";
         $show = Show::firstOrNew(['id' => $value['tvdbid']]);
         $this->getGenres($showData['data']['genre'], $show);
         $this->getEpisodes($showData['data']['season_list'][0], $value['tvdbid']);
         $show->id = $value['tvdbid'];
         $show->lang = $value['language'];
         $show->network = $value['network'];
         $show->quality = $value['quality'];
         $show->show_name = $value['show_name'];
         $show->status = $value['status'];
         $show->tvdb_id = $value['tvdbid'];
         $show->overview = '';
         $show->location = $showData['data']['location'];
         $show->max_season = $showData['data']['season_list'][0];
         $show->save();
     }
 }