public function postCreateAutomatically(Request $request) { if ($request['id'] && $request['num'] && $request['num'] > 0) { $date = time(); $anime = $this->anime->where('id', '=', $request['id'])->first(); // $lastEpisode = $this->episode->where('anime_id', '=', $request['id'])->get()->max('order'); $lastEpisode = $this->episode->where('anime_id', '=', $request['id'])->orderBy('order', 'desc')->first(); if ($lastEpisode) { $currentEpisode = $lastEpisode['order']; $nextEpisode = (int) $currentEpisode + 1; } else { $nextEpisode = 1; } for ($i = 0; $i < $request['num']; $i++) { $title = $anime["title"] . ' Episode ' . $nextEpisode; $con = '<div id="yeird"><div class="text"><span>Anime Title:</span>' . $anime["title"] . '</div> <div class="text"><span>Episode Number:</span>' . $anime["title"] . ' Episode ' . $nextEpisode . '</div> <div class="text"><span>Status:</span>Upcoming</div> <div class="text"><span>About ' . $anime["title"] . ':</span>' . $anime["description"] . '</div> <div class="text"><span class="big">We don\'t have a video available for <strong>' . $anime["title"] . ' Episode ' . $nextEpisode . ' </strong>yet. Please check back later or visit our <strong><a href="' . url('/') . '">HOMEPAGE</a></strong> for the Latest Anime Episodes.</span></div> </div>'; $order = $nextEpisode; $this->episode->create(['title' => $title, 'slug' => str_slug($title), 'not_yet_aired' => $con, 'anime_id' => $request['id'], 'date' => $date, 'date2' => $date, 'order' => $order, 'rating' => 0, 'votes' => 0]); $nextEpisode++; } } }
public function getRelatedForEachAnime(Collection $animes) { $relations = ['prequel', 'sequel', 'story', 'side_story', 'spin_off', 'alternative', 'other']; foreach ($animes as $key => $anime) { foreach ($relations as $relation) { if ($anime[$relation]) { $animesRelated = explode(',', $anime[$relation])[0]; $anime[$relation] = $this->anime->where('id', '=', $animesRelated)->first(); } } $animes[$key] = $anime; } return $animes; }
public function getRelated(Anime $anime) { $relations = ['prequel', 'sequel', 'story', 'side_story', 'spin_off', 'alternative', 'other']; $related = []; foreach ($relations as $relation) { if ($anime[$relation]) { $related[$relation] = $this->anime->where('id', '=', explode(',', $anime[$relation])[0])->first(); } } return $related; }
/** * 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); }