getMovie($id); // dd($movie); // $data = $this->formatTmdbMovie($movie); // dd($data); // $data['meta']['title'] = 'Watch ' . $movie['title']; return $data; }; $results = $call();// Cache::remember(implode('__', ['movie', $id]),3600, $call); $meta['schema'] = SchemaBuilder::getMovieSchema($results); $data = $results; // dd($data); $top = $this->getTopContent($tmdb, $api); // dd($tmdb->getUpcomingMovies(1),); if (empty($data['similar'])) $data['similar'] = $this->formatApiResponse($api->getPopularMovies(1, 8), false)['data']; $upcoming = $this->formatTmdbResponse($tmdb->getUpcomingMovies(1), false, [], 12)['data']; $meta['title'] = Str::replace(['{TITLE}', '{YEAR}'], [$data['title'], $data['year']], config('site.movies.detail.title')); $meta['description'] = Str::limit(Str::replace(['{TITLE}', '{OVERVIEW}'], [$data['title'], $data['overview']], config('site.movies.detail.description')), 150);// sprintf(config('site.movies.detail.description'), $data['overview']); $meta['keywords'] = config('site.movies.detail.keywords'); $meta['image'] = $data['backdrop']; $movie = $data; // $modal = $adsController->shouldGetModal(request()->headers->get('cf-ipcountry', 'AU')); return view('movie', compact('movie', 'upcoming', 'meta', 'top')); } public function movies( ApiClient $api, TmdbClient $tmdb, ?int $page = 1,) { $results = $this->formatApiResponse($api->getPopularMovies($page, 36),true, ['name' => Route::current()->getName()]); $meta['title'] = config('site.movies.list.title', 'Popular Movies'); if ($page > 1) $meta['title'] .= sprintf(' - Page %s', $page); $meta['page_title'] = config('site.movies.list.page_title', 'Popular Movies'); $meta['description'] = config('site.movies.list.description', 'Popular Movies'); $meta['keywords'] = config('site.movies.list.keywords'); $meta['image'] = asset('images/cover.jpg'); $meta['route'] = Route::current(); $pagination = $results['pagination']; // dd($pagination); $data = $results['data']; $type = 'movie'; $genre = false; return view('list', compact('data', 'pagination', 'meta', 'type', 'genre')); } public function movies_more( ApiClient $api, TmdbClient $tmdb, MoreMoviesRequest $moreMoviesRequest) { $results = $this->formatApiResponse($api->getPopularMovies($moreMoviesRequest->validated()['page'], 36), true); $items = MoreTitles::collection($results['data']); $has_more_pages = $results['pagination']->hasMorePages(); $current_page = $results['pagination']->currentPage(); $html = LaravelHtmlMinifyFacade::htmlMinify(view('components.more_titles', compact('items'))->render()); return response()->json(compact('current_page', 'has_more_pages', 'html')); } public function movies_genre_more( ApiClient $api, TmdbClient $tmdb, MoreMoviesGenreRequest $moreMoviesRequest) { $genre = Helpers::getMovieGenreBySlug($moreMoviesRequest->validated()['genre']); $results = $this->formatApiResponse($api->getGenreMovies($genre->id, $moreMoviesRequest->validated()['page'], 36), true); $items = MoreTitles::collection($results['data']); $has_more_pages = $results['pagination']->hasMorePages(); $current_page = $results['pagination']->currentPage(); $html = LaravelHtmlMinifyFacade::htmlMinify(view('components.more_titles', compact('items'))->render()); return response()->json(compact('current_page', 'has_more_pages', 'genre', 'html')); } public function genres( ApiClient $api, TmdbClient $tmdb, string $genre, ?int $page = 1) { $genre = Helpers::getMovieGenreBySlug($genre); if (is_null($genre)) abort(404); $results = $this->formatApiResponse($api->getGenreMovies($genre->id, $page, 36), true, ['name' => Route::current()->getName(), 'params' => ['genre' => $genre->slug]]); $meta['title'] = sprintf(config('site.movies.genres.title', 'Genre Movies'), $genre->name); if ($page > 1) $meta['title'] .= sprintf(' - Page %s', $page); $meta['page_title'] = sprintf(config('site.movies.genres.page_title', 'Genre Movies'), $genre->name); $meta['description'] = sprintf(config('site.movies.genres.description', 'Genre Movies'), $genre->name); $meta['keywords'] = config('site.movies.genres.keywords', null); $meta['image'] = asset('images/cover.jpg'); $meta['route'] = Route::current(); $pagination = $results['pagination']; // dd($pagination); $data = $results['data']; $type = 'movie'; return view('list', compact('data', 'pagination', 'meta', 'genre', 'type')); } public function country( ApiClient $api, TmdbClient $tmdb, string $country, ?int $page = 1) { $country = Helpers::getCountryBySlug($country); if (is_null($country)) abort(404); $results = $this->formatTmdbResponse($tmdb->getCountryMovies($country->code, $page), true, ['name' => Route::current()->getName(), 'params' => ['country' => $country->slug]]); $meta['title'] = sprintf(config('site.movies.country.title', 'Genre Movies'), $country->name); $meta['description'] = sprintf(config('site.movies.country.description', 'Genre Movies'), $country->name); $meta['image'] = asset('images/custom.jpg'); $meta['route'] = 'movie'; $pagination = $results['pagination']; $data = $results['data']; if (defined('SHOULD_PRERENDER')) { return view('prerender.list', compact('data', 'pagination', 'meta')); } $pagination = self::encodeForInertia($pagination); $data = self::encodeForInertia($data ?? []); $meta = self::encodeForInertia($meta ?? []) ; } public function toprated( ApiClient $api, TmdbClient $tmdb, ?int $page = 1) { $results = $this->formatTmdbResponse($tmdb->getTopRatedMovies($page), true, ['name' => Route::current()->getName()]); $meta['title'] = config('site.movies.top-imdb.title', 'Top IMDb Movies'); $meta['description'] = config('site.movies.top-imd.description', 'Top IMDb Movies'); $meta['image'] = asset('images/custom.jpg'); $meta['route'] = 'movie'; $pagination = $results['pagination']; $data = $results['data']; if (defined('SHOULD_PRERENDER')) { return view('prerender.list', compact('data', 'pagination', 'meta')); } $pagination = self::encodeForInertia($pagination); $data = self::encodeForInertia($data ?? []); $meta = self::encodeForInertia($meta ?? []) ; return Inertia::render('List', compact('data', 'pagination', 'meta')); } }