/** * @param Anime $anime * @param Page $page * @param Option $option */ public function __construct(Anime $anime, Page $page, Option $option) { $this->anime = $anime; $this->page = $page; $this->option = $option; $this->data['animeBanner'] = $this->anime->orderByRaw("RAND()")->where('type2', '=', 'subbed')->take(1)->first(); $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(); }
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); }
/** * Create a new page error composer. * @param Page $page * @param Option $option * @param Anime $anime */ public function __construct(Page $page, Option $option, Anime $anime) { $this->page = $page; $this->option = $option; $this->anime = $anime; $this->data['options'] = $this->option->all(); $this->data['animeBanner'] = $this->anime->orderByRaw("RAND()")->where('type2', '=', 'subbed')->take(1)->first(); $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['pageTitle'] = $pageTitle = "Sorry, the page you have requested cannot be found."; $this->data['metaTitle'] = $pageTitle; $this->data['metaDesc'] = $pageTitle; $this->data['metaKey'] = $pageTitle; }