public function getDubbedAnime($slug)
 {
     $this->data['anime'] = $anime = $this->anime->with(['episodes' => function ($query) {
         $query->orderBy('order', 'asc');
     }])->where('slug', '=', $slug)->where('type2', '=', 'dubbed')->firstOrFail();
     $this->anime->where('id', '=', $anime['id'])->update(['visits' => $anime['visits'] + 1]);
     $this->data['lastEpisode'] = $this->episode->where('anime_id', '=', $anime['id'])->where('not_yet_aired', '=', null)->orWhere('anime_id', '=', $anime['id'])->where('not_yet_aired', '=', '')->orderBy('id', 'DESC')->first();
     $this->data['genres'] = explode(",", $anime['genres']);
     $this->data['type'] = explode(",", $anime['type']);
     $countSimilar = $this->anime->where('id', '=', $anime['id'])->where('genres', '=', $anime['genres'])->take(12)->count();
     $this->data['animeSimilar'] = $this->anime->where('id', '=', $anime['id'])->where('genres', '=', $anime['genres'])->take(rand(0, $countSimilar))->get();
     switch ($anime['age']) {
         case "Anyone":
             $color = "#EE82EE";
             break;
         case "Teen +17":
             $color = "#CC0033";
             break;
         case "Teen +18":
             $color = "#FF0000";
             break;
         default:
             $color = "#C86464";
     }
     $this->data['color'] = $color;
     $this->data['animeBanner'] = $this->anime->orderByRaw("RAND()")->where('type2', '=', 'subbed')->take(1)->first();
     $this->data['relations'] = $this->getRelated($anime);
     $this->data['pageTitle'] = $title = $anime['title'] . " English Subbed/Dubbed in HD";
     $this->data['metaTitle'] = "Watch {$anime['title']} Online for Free | Watch Anime Online Free";
     $this->data['metaDesc'] = "Watch " . $title . " Online. Download " . $title . " Online. Watch " . $anime['title'] . " English Sub/Dub HD";
     $this->data['metaKey'] = "Watch {$anime['title']}, {$anime['title']} English Subbed/Dubbed, Download " . "{$anime['title']} English Subbed/Dubbed, Watch {$anime['title']} Online";
     return view('anime.show', $this->data);
 }
 public function getLatest()
 {
     $this->data['episodes'] = $episode = $this->episode->with('anime')->where('show', '=', '1')->where('date', '>', strtotime('-1 month'))->orderBy('date', 'DESC')->paginate(24);
     $this->data['pageTitle'] = "Latest Episodes | Watch Anime Online Free";
     $this->data['metaTitle'] = "Watch the Latest Episode for Free Online | Watch Anime Online Free just in " . "Animecenter.tv";
     $this->data['metaDesc'] = "Watch Latest Anime Episodes added to the site! Latest English Subbed/Dubbed Anime";
     $this->data['metaKey'] = "Latest Anime Episodes, Watch Latest Anime Episodes, Watch on Iphone, Watch Anime" . " Online, English Subbed/Dubbed";
     return view('episodes.latest', $this->data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $this->data['pageTitle'] = "Home";
     $this->data['desc'] = "Home Page";
     $this->data['animesCount'] = $this->anime->where('position', '=', 'recently')->orWhere('position', '=', 'all')->get()->count();
     $this->data['episodesList'] = $this->episode->with('anime')->where('show', '=', 1)->orderBy('date', 'DESC')->take('12')->get();
     $this->data['imagesList'] = $this->image->orderBy('date', 'DESC')->take(10)->get();
     $this->data['topPagesList'] = $this->page->where('position', '=', 'top')->orderBy('order')->get();
     $this->data['bottomPagesList'] = $this->page->where('position', '=', 'bottom1')->orderBy('order')->get();
     $this->data['bottomPagesList2'] = $this->page->where('position', '=', 'bottom2')->orderBy('order')->get();
     $this->data['bottomPagesList3'] = $this->page->where('position', '=', 'bottom3')->orderBy('order')->get();
     $this->data['options'] = $this->option->all();
     $this->data['animeList'] = $this->anime->where('position', '=', 'recently')->orWhere('position', '=', 'all')->orderBy('id', 'DESC')->take(8)->get();
     $this->data['upcomingEpisodes'] = $this->episode->with('anime')->where('coming_date', '<>', '')->where('not_yet_aired', '<>', '')->orderBy('coming_date', 'ASC')->take(6)->get();
     $this->data['pageTitle'] = $title = "AnimeCenter: Watch Anime English Subbed/Dubbed Online in HD";
     $this->data['metaTitle'] = "Watch Anime Online English Subbed/Dubbed | Watch Anime Online Free";
     $this->data['metaDesc'] = "Watch Anime English Subbed/Dubbed Online in HD at AnimeCenter! Over 41000 Episodes" . ", and 2,146 Anime Series!";
     $this->data['metaKey'] = "Watch Anime Online, Anime Subbed/Dubbed, Anime Episodes, Anime Stream, " . "Subbed Anime, Dubbed Anime";
     return view('home.index', $this->data);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param int $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getDelete($id = 0)
 {
     $this->episode->findOrFail($id)->delete();
     $msg = 'Episode was deleted successfully!';
     return redirect()->action('Admin\\EpisodeController@index')->with('success', $msg);
 }