add search page
This commit is contained in:
parent
852c2f5993
commit
dc30424db9
22 changed files with 828 additions and 350 deletions
|
@ -3,9 +3,11 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\SearchRequest;
|
||||
use App\Http\Resources\MoreTitles;
|
||||
use App\Models\News;
|
||||
use App\Services\ApiClient;
|
||||
use App\Services\TmdbClient;
|
||||
use DipeshSukhia\LaravelHtmlMinify\LaravelHtmlMinifyFacade;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Supports\Traits\Helpers;
|
||||
use Illuminate\Support\Str;
|
||||
|
@ -13,6 +15,7 @@
|
|||
use App\Supports\Traits\CleanItems;
|
||||
use App\Supports\Traits\TopContent;
|
||||
|
||||
use Route;
|
||||
use stdClass;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
@ -71,21 +74,44 @@ public function homesearch()
|
|||
}
|
||||
|
||||
|
||||
public function search(SearchRequest $request, ApiClient $api, TmdbClient $tmdb)
|
||||
public function search(SearchRequest $request, TmdbClient $tmdb)
|
||||
{
|
||||
$query = $request->validated()['search'];
|
||||
$results = $tmdb->getSearch($query);
|
||||
$data = $this->formatTmdbSearchResponse($results);
|
||||
$page = $request->query('page', 1);
|
||||
$results = $tmdb->getSearch($query, $page);
|
||||
['data' => $data, 'pagination' => $pagination] = $this->formatTmdbSearchResponse($results);
|
||||
$page_text = ($page > 1)
|
||||
? sprintf(' - Page %s', $page)
|
||||
: '';
|
||||
|
||||
|
||||
$meta = [];
|
||||
$meta['title'] = config('site.search.title');
|
||||
$meta['description'] = Str::replace(['{QUERY}'], $query, config('site.search.description'));
|
||||
$meta['title'] = str(config('site.search.title'))->replace(['{QUERY}'], $query)->replace(['{PAGE}'], $page_text)->apa();
|
||||
$meta['description'] = str(config('site.search.description'))->replace(['{QUERY}'], $query)->replace(['{PAGE}'], $page_text);
|
||||
$meta['keywords'] = config('site.search.keywords', false);
|
||||
$meta['image'] = asset('images/custom-icon.png');
|
||||
$meta['page_title'] = 'Search Results for: '. $query;
|
||||
$meta['route'] = Route::current();
|
||||
// dd($meta['route']);
|
||||
|
||||
// $query = str($query)->apa();
|
||||
|
||||
// sleep(2);
|
||||
return view('search', compact('data', 'meta'));
|
||||
return view('search', compact('data', 'pagination', 'meta', 'query'));
|
||||
|
||||
}
|
||||
public function search_more(SearchRequest $request, TmdbClient $tmdb)
|
||||
{
|
||||
$query = $request->validated()['search'];
|
||||
$page = $request->validated()['page'];
|
||||
$results = $this->formatTmdbSearchResponse($tmdb->getSearch($query, $page));
|
||||
// dd($results);
|
||||
$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'));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ public function authorize(): bool
|
|||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'search' => 'required|min:2'
|
||||
'search' => 'required|min:2',
|
||||
'page' => 'integer'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ShowRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'id' => 'numeric|required',
|
||||
'slug' => 'string|required',
|
||||
];
|
||||
}
|
||||
}
|
|
@ -260,14 +260,14 @@ public function getTopRatedMovies($page = 1)
|
|||
|
||||
}
|
||||
|
||||
public function getSearch(string $query)
|
||||
public function getSearch(string $query, int $page = 1)
|
||||
{
|
||||
$kw = str_replace('-', ' ',$query);
|
||||
$kw = urlencode($kw);
|
||||
|
||||
$call = fn() => $this->client->getSearchApi()->searchMulti($kw);
|
||||
$call = fn() => $this->client->getSearchApi()->searchMulti($kw, ['page' => $page]);
|
||||
if ($this->use_cache)
|
||||
return Cache::remember('search'.$kw, $this->ttl, $call);
|
||||
return Cache::remember('search'.$kw.'_'.$page, $this->ttl, $call);
|
||||
|
||||
return $call();
|
||||
}
|
||||
|
|
|
@ -1,204 +1,9 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Carbon;
|
||||
namespace App\Supports;
|
||||
|
||||
|
||||
function img_url($size, $path, $photon = true, $w = 300, $h = 450)
|
||||
{
|
||||
if (empty($path)) {
|
||||
return asset('images/placeholder.webp');
|
||||
}
|
||||
if ($photon) {
|
||||
// return "//i1.wp.com/image.tmdb.org/t/p/{$size}{$path}?resize=300,450";
|
||||
// return "https://cdn.statically.io/img/image.tmdb.org/f=auto,q=80,w={$w},h={$h}/t/p/{$size}{$path}";
|
||||
return "https://i1.wp.com/image.tmdb.org/t/p/{$size}{$path}?ssl=1&resize={$w},{$h}";
|
||||
|
||||
}
|
||||
return "https://image.tmdb.org/t/p/{$size}{$path}";
|
||||
}
|
||||
|
||||
function item($item)
|
||||
{
|
||||
if (isset($item->title)) { // is movie
|
||||
$title = $item->title;
|
||||
$link = route('movie', ['id' => $item->id, 'name' => Str::slug($item->title)]);
|
||||
} else {
|
||||
$title = $item->name;
|
||||
$link = route('show', ['id' => $item->id, 'name' => Str::slug($item->name)]);
|
||||
}
|
||||
|
||||
return (object)[
|
||||
'link' => $link,
|
||||
'title' => $title
|
||||
];
|
||||
}
|
||||
|
||||
function release_date($release_date)
|
||||
{
|
||||
return date('M d, Y', strtotime($release_date));
|
||||
}
|
||||
|
||||
function release_date_year($release_date)
|
||||
{
|
||||
return date('Y', strtotime($release_date));
|
||||
}
|
||||
|
||||
function minToHour($min, $array_in = false)
|
||||
{
|
||||
|
||||
if ($array_in) {
|
||||
if (!empty($min)) {
|
||||
$min = $min[0];
|
||||
} else {
|
||||
return 'NA';
|
||||
}
|
||||
}
|
||||
$d = floor($min / 1440);
|
||||
$h = floor(($min - $d * 1440) / 60);
|
||||
$m = $min - ($d * 1440) - ($h * 60);
|
||||
|
||||
if ($min < 60) {
|
||||
return "{$m}m";
|
||||
}
|
||||
return "{$h}h {$m}m";
|
||||
}
|
||||
if (!function_exists('cast_to_object')) {
|
||||
function cast_to_object($array)
|
||||
{
|
||||
$object = new stdClass();
|
||||
foreach ($array as $key => $value) {
|
||||
|
||||
$object->$key = is_array($value) ? cast_to_object($value) : $value;
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_movie_genres_list($as_object = true)
|
||||
{
|
||||
|
||||
$genres = [
|
||||
['id' => '28', 'name' => 'Action'],
|
||||
['id' => '12', 'name' => 'Adventure'],
|
||||
['id' => '16', 'name' => 'Animation'],
|
||||
['id' => '35', 'name' => 'Comedy'],
|
||||
['id' => '80', 'name' => 'Crime'],
|
||||
['id' => '99', 'name' => 'Documentary'],
|
||||
['id' => '18', 'name' => 'Drama'],
|
||||
['id' => '10751', 'name' => 'Family'],
|
||||
['id' => '14', 'name' => 'Fantasy'],
|
||||
['id' => '36', 'name' => 'History'],
|
||||
['id' => '27', 'name' => 'Horror'],
|
||||
['id' => '10402', 'name' => 'Music'],
|
||||
['id' => '9648', 'name' => 'Mystery'],
|
||||
['id' => '10749', 'name' => 'Romance'],
|
||||
['id' => '878', 'name' => 'Science Fiction'],
|
||||
['id' => '10770', 'name' => 'TV Movie'],
|
||||
['id' => '53', 'name' => 'Thriller'],
|
||||
['id' => '10752', 'name' => 'War'],
|
||||
['id' => '37', 'name' => 'Western'],
|
||||
];
|
||||
|
||||
return $as_object ? cast_to_object($genres) : $genres;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_tv_genres_list($as_object = true)
|
||||
{
|
||||
$genres = [
|
||||
['id' => '10759', 'name' => 'Action & Adventure'],
|
||||
['id' => '16', 'name' => 'Animation'],
|
||||
['id' => '35', 'name' => 'Comedy'],
|
||||
['id' => '80', 'name' => 'Crime'],
|
||||
['id' => '99', 'name' => 'Documentary'],
|
||||
['id' => '18', 'name' => 'Drama'],
|
||||
['id' => '10751', 'name' => 'Family'],
|
||||
['id' => '10762', 'name' => 'Kids'],
|
||||
['id' => '9648', 'name' => 'Mystery'],
|
||||
['id' => '10763', 'name' => 'News'],
|
||||
['id' => '10764', 'name' => 'Reality'],
|
||||
['id' => '10765', 'name' => 'Sci-Fi & Fantasy'],
|
||||
['id' => '10766', 'name' => 'Soap'],
|
||||
['id' => '10767', 'name' => 'Talk'],
|
||||
['id' => '10768', 'name' => 'War & Politics'],
|
||||
['id' => '37', 'name' => 'Western'],
|
||||
];
|
||||
|
||||
return $as_object ? cast_to_object($genres) : $genres;
|
||||
}
|
||||
|
||||
|
||||
function genres($genres, $type = 'movie', $as_object = true)
|
||||
{
|
||||
$path = $type === 'movie' ? 'films' : 'tv-shows';
|
||||
$results = array_map(function ($genre) use ($path) {
|
||||
return [
|
||||
'link' => url($path . '/genre/' . Str::slug($genre->name) . '/' . $genre->id),
|
||||
'name' => $genre->name
|
||||
];
|
||||
}, $genres);
|
||||
return $as_object ? cast_to_object($results) : $results;
|
||||
}
|
||||
|
||||
function actors($actors, $limit = 5)
|
||||
{
|
||||
return array_map(function ($actor) {
|
||||
return (object)[
|
||||
'name' => $actor->name
|
||||
];
|
||||
}, collect($actors)->take($limit)->toArray());
|
||||
// return collect($results)->take(3);
|
||||
}
|
||||
|
||||
function detect_device()
|
||||
{
|
||||
// return new \Jenssegers\Agent\Agent();
|
||||
}
|
||||
|
||||
function is_bing()
|
||||
{
|
||||
$agent = detect_device();
|
||||
$bing_regex = '/bingbot|bing|slurp|altavista|trident|aol|dogpile|duckduckbot|ecosia|ekoru|elliot|enow|excite|gaia|givero|goodshop|info|kol|lilo|metacrawler|mojeek|oceanhero|oscobo|qwantify|searchencrypt|searchscene|serch|swiss|webcrawler|youcare|msnbot/i';
|
||||
// dd($agent->getUserAgent());
|
||||
// return $agent->match($bing_regex);
|
||||
}
|
||||
|
||||
function get_country_code()
|
||||
{
|
||||
$country_code = 'RO';
|
||||
if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {
|
||||
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'];
|
||||
} elseif (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {
|
||||
$country_code = $_SERVER['COUNTRY_CODE'];
|
||||
}
|
||||
|
||||
return $country_code;
|
||||
}
|
||||
|
||||
function is_country($country = 'US', $negate = false)
|
||||
{
|
||||
$res = (bool) preg_match('~'.$country.'~', get_country_code());
|
||||
|
||||
return $negate ? !$res : $res;
|
||||
}
|
||||
|
||||
function is_primary_country($negate = false)
|
||||
{
|
||||
$res = (bool) preg_match('~'.config('ads.country_primary').'~', get_country_code());
|
||||
|
||||
return $negate ? !$res : $res;
|
||||
}
|
||||
|
||||
function host_key() {
|
||||
return ucfirst(str_replace('.', '', $_SERVER['HTTP_HOST']));
|
||||
}
|
||||
|
||||
function url_starts_with($perma)
|
||||
{
|
||||
return (bool) preg_match('~/'.$perma.'~', ltrim(request()->getPathInfo()));
|
||||
|
||||
class Helpers {
|
||||
use \App\Supports\Traits\Helpers;
|
||||
}
|
||||
|
|
204
app/Supports/OldHelpers.php
Normal file
204
app/Supports/OldHelpers.php
Normal file
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
|
||||
function img_url($size, $path, $photon = true, $w = 300, $h = 450)
|
||||
{
|
||||
if (empty($path)) {
|
||||
return asset('images/placeholder.webp');
|
||||
}
|
||||
if ($photon) {
|
||||
// return "//i1.wp.com/image.tmdb.org/t/p/{$size}{$path}?resize=300,450";
|
||||
// return "https://cdn.statically.io/img/image.tmdb.org/f=auto,q=80,w={$w},h={$h}/t/p/{$size}{$path}";
|
||||
return "https://i1.wp.com/image.tmdb.org/t/p/{$size}{$path}?ssl=1&resize={$w},{$h}";
|
||||
|
||||
}
|
||||
return "https://image.tmdb.org/t/p/{$size}{$path}";
|
||||
}
|
||||
|
||||
function item($item)
|
||||
{
|
||||
if (isset($item->title)) { // is movie
|
||||
$title = $item->title;
|
||||
$link = route('movie', ['id' => $item->id, 'name' => Str::slug($item->title)]);
|
||||
} else {
|
||||
$title = $item->name;
|
||||
$link = route('show', ['id' => $item->id, 'name' => Str::slug($item->name)]);
|
||||
}
|
||||
|
||||
return (object)[
|
||||
'link' => $link,
|
||||
'title' => $title
|
||||
];
|
||||
}
|
||||
|
||||
function release_date($release_date)
|
||||
{
|
||||
return date('M d, Y', strtotime($release_date));
|
||||
}
|
||||
|
||||
function release_date_year($release_date)
|
||||
{
|
||||
return date('Y', strtotime($release_date));
|
||||
}
|
||||
|
||||
function minToHour($min, $array_in = false)
|
||||
{
|
||||
|
||||
if ($array_in) {
|
||||
if (!empty($min)) {
|
||||
$min = $min[0];
|
||||
} else {
|
||||
return 'NA';
|
||||
}
|
||||
}
|
||||
$d = floor($min / 1440);
|
||||
$h = floor(($min - $d * 1440) / 60);
|
||||
$m = $min - ($d * 1440) - ($h * 60);
|
||||
|
||||
if ($min < 60) {
|
||||
return "{$m}m";
|
||||
}
|
||||
return "{$h}h {$m}m";
|
||||
}
|
||||
if (!function_exists('cast_to_object')) {
|
||||
function cast_to_object($array)
|
||||
{
|
||||
$object = new stdClass();
|
||||
foreach ($array as $key => $value) {
|
||||
|
||||
$object->$key = is_array($value) ? cast_to_object($value) : $value;
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_movie_genres_list($as_object = true)
|
||||
{
|
||||
|
||||
$genres = [
|
||||
['id' => '28', 'name' => 'Action'],
|
||||
['id' => '12', 'name' => 'Adventure'],
|
||||
['id' => '16', 'name' => 'Animation'],
|
||||
['id' => '35', 'name' => 'Comedy'],
|
||||
['id' => '80', 'name' => 'Crime'],
|
||||
['id' => '99', 'name' => 'Documentary'],
|
||||
['id' => '18', 'name' => 'Drama'],
|
||||
['id' => '10751', 'name' => 'Family'],
|
||||
['id' => '14', 'name' => 'Fantasy'],
|
||||
['id' => '36', 'name' => 'History'],
|
||||
['id' => '27', 'name' => 'Horror'],
|
||||
['id' => '10402', 'name' => 'Music'],
|
||||
['id' => '9648', 'name' => 'Mystery'],
|
||||
['id' => '10749', 'name' => 'Romance'],
|
||||
['id' => '878', 'name' => 'Science Fiction'],
|
||||
['id' => '10770', 'name' => 'TV Movie'],
|
||||
['id' => '53', 'name' => 'Thriller'],
|
||||
['id' => '10752', 'name' => 'War'],
|
||||
['id' => '37', 'name' => 'Western'],
|
||||
];
|
||||
|
||||
return $as_object ? cast_to_object($genres) : $genres;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get_tv_genres_list($as_object = true)
|
||||
{
|
||||
$genres = [
|
||||
['id' => '10759', 'name' => 'Action & Adventure'],
|
||||
['id' => '16', 'name' => 'Animation'],
|
||||
['id' => '35', 'name' => 'Comedy'],
|
||||
['id' => '80', 'name' => 'Crime'],
|
||||
['id' => '99', 'name' => 'Documentary'],
|
||||
['id' => '18', 'name' => 'Drama'],
|
||||
['id' => '10751', 'name' => 'Family'],
|
||||
['id' => '10762', 'name' => 'Kids'],
|
||||
['id' => '9648', 'name' => 'Mystery'],
|
||||
['id' => '10763', 'name' => 'News'],
|
||||
['id' => '10764', 'name' => 'Reality'],
|
||||
['id' => '10765', 'name' => 'Sci-Fi & Fantasy'],
|
||||
['id' => '10766', 'name' => 'Soap'],
|
||||
['id' => '10767', 'name' => 'Talk'],
|
||||
['id' => '10768', 'name' => 'War & Politics'],
|
||||
['id' => '37', 'name' => 'Western'],
|
||||
];
|
||||
|
||||
return $as_object ? cast_to_object($genres) : $genres;
|
||||
}
|
||||
|
||||
|
||||
function genres($genres, $type = 'movie', $as_object = true)
|
||||
{
|
||||
$path = $type === 'movie' ? 'films' : 'tv-shows';
|
||||
$results = array_map(function ($genre) use ($path) {
|
||||
return [
|
||||
'link' => url($path . '/genre/' . Str::slug($genre->name) . '/' . $genre->id),
|
||||
'name' => $genre->name
|
||||
];
|
||||
}, $genres);
|
||||
return $as_object ? cast_to_object($results) : $results;
|
||||
}
|
||||
|
||||
function actors($actors, $limit = 5)
|
||||
{
|
||||
return array_map(function ($actor) {
|
||||
return (object)[
|
||||
'name' => $actor->name
|
||||
];
|
||||
}, collect($actors)->take($limit)->toArray());
|
||||
// return collect($results)->take(3);
|
||||
}
|
||||
|
||||
function detect_device()
|
||||
{
|
||||
// return new \Jenssegers\Agent\Agent();
|
||||
}
|
||||
|
||||
function is_bing()
|
||||
{
|
||||
$agent = detect_device();
|
||||
$bing_regex = '/bingbot|bing|slurp|altavista|trident|aol|dogpile|duckduckbot|ecosia|ekoru|elliot|enow|excite|gaia|givero|goodshop|info|kol|lilo|metacrawler|mojeek|oceanhero|oscobo|qwantify|searchencrypt|searchscene|serch|swiss|webcrawler|youcare|msnbot/i';
|
||||
// dd($agent->getUserAgent());
|
||||
// return $agent->match($bing_regex);
|
||||
}
|
||||
|
||||
function get_country_code()
|
||||
{
|
||||
$country_code = 'RO';
|
||||
if (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {
|
||||
$country_code = $_SERVER['HTTP_CF_IPCOUNTRY'];
|
||||
} elseif (isset($_SERVER['HTTP_CF_IPCOUNTRY'])) {
|
||||
$country_code = $_SERVER['COUNTRY_CODE'];
|
||||
}
|
||||
|
||||
return $country_code;
|
||||
}
|
||||
|
||||
function is_country($country = 'US', $negate = false)
|
||||
{
|
||||
$res = (bool) preg_match('~'.$country.'~', get_country_code());
|
||||
|
||||
return $negate ? !$res : $res;
|
||||
}
|
||||
|
||||
function is_primary_country($negate = false)
|
||||
{
|
||||
$res = (bool) preg_match('~'.config('ads.country_primary').'~', get_country_code());
|
||||
|
||||
return $negate ? !$res : $res;
|
||||
}
|
||||
|
||||
function host_key() {
|
||||
return ucfirst(str_replace('.', '', $_SERVER['HTTP_HOST']));
|
||||
}
|
||||
|
||||
function url_starts_with($perma)
|
||||
{
|
||||
return (bool) preg_match('~/'.$perma.'~', ltrim(request()->getPathInfo()));
|
||||
}
|
|
@ -110,7 +110,7 @@ public function formatTmdbShow($data):array
|
|||
$show['companies'] = collect($data['production_companies'])->implode('name', ', ');
|
||||
$show['trailer'] = $data['videos']['results'][0]['key'] ?? false;
|
||||
$show['seasons'] = collect($data['seasons'])->where('season_number', '>', 0)->map(function($season){
|
||||
$season['poster'] = $this->getImageUrl($season['poster_path'], 'w500', 240, 360);
|
||||
$season['poster'] = $this->getImageUrl($season['poster_path'], 'w500', 120, 180);
|
||||
unset($season['poster_path']);
|
||||
return $season;
|
||||
})->values()->all();
|
||||
|
@ -129,7 +129,7 @@ public function formatTmdbSeason($data, $showData):array
|
|||
$show['label'] = 'S'.str_pad($data['season_number'], 2, '0', STR_PAD_LEFT);
|
||||
$show['overview'] = $data['overview'] !== '' ? $data['overview'] : $showData['overview'];
|
||||
$show['cast'] = $this->getCast($show['credits']['cast'] ?? $showData['credits']['cast'] ?? [], 8);
|
||||
$show['crew'] = $this->getCrew($show['credits']['crew'] ?? $showData['credits']['crew'] ?? [], 8);
|
||||
$show['crew']['producers'] = $this->getCrew($show['credits']['crew'] ?? $showData['credits']['crew'] ?? [], 8);
|
||||
$show['air_date'] = Helpers::formatReleaseDate($data['air_date']);
|
||||
$show['poster'] = $this->getImageUrl($data['poster_path'], 'w500', 230, 345);
|
||||
$show['episodes'] = collect($show['episodes'])->map(function($episode){
|
||||
|
@ -292,10 +292,15 @@ public function formatTmdbSearchResponse(array $data): array
|
|||
'year' => isset($item->release_date) ? Carbon::parse($item->release_date ?? '')->format('Y') : Carbon::parse($item->first_air_date ?? '')->format('Y'),
|
||||
'type' => match($item->media_type) {'movie' => 'movie', 'tv' => 'show'},
|
||||
];
|
||||
})->groupBy('type')->map(fn($typeItems) => $typeItems->all())->all();
|
||||
})/* ->map(fn($typeItems) => $typeItems->all()) */->all();
|
||||
}
|
||||
// dd($results);
|
||||
return $results;
|
||||
$response['data'] = $results;
|
||||
|
||||
$response['pagination'] = new LengthAwarePaginator($response['data'], $data['total_results'], 20, $data['page'], [
|
||||
'path' => request()->url()
|
||||
]);
|
||||
|
||||
return $response;
|
||||
}
|
||||
public function formatTmdbResponse(array $data, $with_pagination = false, $route = [], $limit = false): array
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"symfony/http-client": "^6.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.13",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.0.1",
|
||||
|
|
156
composer.lock
generated
156
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "600acfe52dbf196e33f48c07c30da779",
|
||||
"content-hash": "23a3f2913e34169f3caa28ba2659974c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
|
@ -7279,6 +7279,90 @@
|
|||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "barryvdh/laravel-debugbar",
|
||||
"version": "v3.13.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/barryvdh/laravel-debugbar.git",
|
||||
"reference": "92d86be45ee54edff735e46856f64f14b6a8bb07"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/92d86be45ee54edff735e46856f64f14b6a8bb07",
|
||||
"reference": "92d86be45ee54edff735e46856f64f14b6a8bb07",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/routing": "^9|^10|^11",
|
||||
"illuminate/session": "^9|^10|^11",
|
||||
"illuminate/support": "^9|^10|^11",
|
||||
"maximebf/debugbar": "~1.22.0",
|
||||
"php": "^8.0",
|
||||
"symfony/finder": "^6|^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.3",
|
||||
"orchestra/testbench-dusk": "^5|^6|^7|^8|^9",
|
||||
"phpunit/phpunit": "^9.6|^10.5",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.13-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Barryvdh\\Debugbar\\ServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Debugbar": "Barryvdh\\Debugbar\\Facades\\Debugbar"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Barryvdh\\Debugbar\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Barry vd. Heuvel",
|
||||
"email": "barryvdh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "PHP Debugbar integration for Laravel",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"debugbar",
|
||||
"laravel",
|
||||
"profiler",
|
||||
"webprofiler"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/barryvdh/laravel-debugbar/issues",
|
||||
"source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.13.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://fruitcake.nl",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/barryvdh",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-04-12T11:20:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
"version": "2.0.0",
|
||||
|
@ -7663,6 +7747,74 @@
|
|||
},
|
||||
"time": "2024-08-02T07:45:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
"version": "v1.22.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/maximebf/php-debugbar.git",
|
||||
"reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96",
|
||||
"reference": "7aa9a27a0b1158ed5ad4e7175e8d3aee9a818b96",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2|^8",
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/var-dumper": "^4|^5|^6|^7"
|
||||
},
|
||||
"require-dev": {
|
||||
"dbrekelmans/bdi": "^1",
|
||||
"phpunit/phpunit": "^8|^9",
|
||||
"symfony/panther": "^1|^2.1",
|
||||
"twig/twig": "^1.38|^2.7|^3.0"
|
||||
},
|
||||
"suggest": {
|
||||
"kriswallsmith/assetic": "The best way to manage assets",
|
||||
"monolog/monolog": "Log using Monolog",
|
||||
"predis/predis": "Redis storage"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.22-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"DebugBar\\": "src/DebugBar/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Maxime Bouroumeau-Fuseau",
|
||||
"email": "maxime.bouroumeau@gmail.com",
|
||||
"homepage": "http://maximebf.com"
|
||||
},
|
||||
{
|
||||
"name": "Barry vd. Heuvel",
|
||||
"email": "barryvdh@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "Debug bar in the browser for php application",
|
||||
"homepage": "https://github.com/maximebf/php-debugbar",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"debugbar"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/maximebf/php-debugbar/issues",
|
||||
"source": "https://github.com/maximebf/php-debugbar/tree/v1.22.3"
|
||||
},
|
||||
"time": "2024-04-03T19:39:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mockery/mockery",
|
||||
"version": "1.6.12",
|
||||
|
@ -9587,5 +9739,5 @@
|
|||
"php": "^8.0.2"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.6.0"
|
||||
"plugin-api-version": "2.3.0"
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
||||
'Helpers' => App\Supports\Traits\Helpers::class,
|
||||
'Helpers' => App\Supports\Helpers::class,
|
||||
|
||||
])->toArray(),
|
||||
|
||||
|
|
325
config/debugbar.php
Normal file
325
config/debugbar.php
Normal file
|
@ -0,0 +1,325 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Debugbar Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Debugbar is enabled by default, when debug is set to true in app.php.
|
||||
| You can override the value by setting enable to true or false instead of null.
|
||||
|
|
||||
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('DEBUGBAR_ENABLED', null),
|
||||
'except' => [
|
||||
'telescope*',
|
||||
'horizon*',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Storage settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| DebugBar stores data for session/ajax requests.
|
||||
| You can disable this, so the debugbar stores data in headers/session,
|
||||
| but this can cause problems with large data collectors.
|
||||
| By default, file storage (in the storage folder) is used. Redis and PDO
|
||||
| can also be used. For PDO, run the package migrations first.
|
||||
|
|
||||
| Warning: Enabling storage.open will allow everyone to access previous
|
||||
| request, do not enable open storage in publicly available environments!
|
||||
| Specify a callback if you want to limit based on IP or authentication.
|
||||
| Leaving it to null will allow localhost only.
|
||||
*/
|
||||
'storage' => [
|
||||
'enabled' => true,
|
||||
'open' => env('DEBUGBAR_OPEN_STORAGE'), // bool/callback.
|
||||
'driver' => 'redis', // redis, file, pdo, socket, custom
|
||||
'path' => storage_path('debugbar'), // For file driver
|
||||
'connection' => null, // Leave null for default connection (Redis/PDO)
|
||||
'provider' => '', // Instance of StorageInterface for custom driver
|
||||
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
|
||||
'port' => 2304, // Port to use with the "socket" driver
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Editor
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Choose your preferred editor to use when clicking file name.
|
||||
|
|
||||
| Supported: "phpstorm", "vscode", "vscode-insiders", "vscode-remote",
|
||||
| "vscode-insiders-remote", "vscodium", "textmate", "emacs",
|
||||
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
|
||||
| "xdebug", "espresso"
|
||||
|
|
||||
*/
|
||||
|
||||
'editor' => env('DEBUGBAR_EDITOR') ?: env('IGNITION_EDITOR', 'phpstorm'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Remote Path Mapping
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using a remote dev server, like Laravel Homestead, Docker, or
|
||||
| even a remote VPS, it will be necessary to specify your path mapping.
|
||||
|
|
||||
| Leaving one, or both of these, empty or null will not trigger the remote
|
||||
| URL changes and Debugbar will treat your editor links as local files.
|
||||
|
|
||||
| "remote_sites_path" is an absolute base path for your sites or projects
|
||||
| in Homestead, Vagrant, Docker, or another remote development server.
|
||||
|
|
||||
| Example value: "/home/vagrant/Code"
|
||||
|
|
||||
| "local_sites_path" is an absolute base path for your sites or projects
|
||||
| on your local computer where your IDE or code editor is running on.
|
||||
|
|
||||
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
||||
|
|
||||
*/
|
||||
|
||||
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH'),
|
||||
'local_sites_path' => env('DEBUGBAR_LOCAL_SITES_PATH', env('IGNITION_LOCAL_SITES_PATH')),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Vendors
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Vendor files are included by default, but can be set to false.
|
||||
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
|
||||
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
|
||||
| and for js: jquery and highlight.js
|
||||
| So if you want syntax highlighting, set it to true.
|
||||
| jQuery is set to not conflict with existing jQuery scripts.
|
||||
|
|
||||
*/
|
||||
|
||||
'include_vendors' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Capture Ajax Requests
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
|
||||
| you can use this option to disable sending the data through the headers.
|
||||
|
|
||||
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
|
||||
|
|
||||
| Note for your request to be identified as ajax requests they must either send the header
|
||||
| X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header.
|
||||
|
|
||||
| By default `ajax_handler_auto_show` is set to true allowing ajax requests to be shown automatically in the Debugbar.
|
||||
| Changing `ajax_handler_auto_show` to false will prevent the Debugbar from reloading.
|
||||
*/
|
||||
|
||||
'capture_ajax' => true,
|
||||
'add_ajax_timing' => false,
|
||||
'ajax_handler_auto_show' => true,
|
||||
'ajax_handler_enable_tab' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Error Handler for Deprecated warnings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When enabled, the Debugbar shows deprecated warnings for Symfony components
|
||||
| in the Messages tab.
|
||||
|
|
||||
*/
|
||||
'error_handler' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Clockwork integration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
|
||||
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
||||
|
|
||||
*/
|
||||
'clockwork' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DataCollectors
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Enable/disable DataCollectors
|
||||
|
|
||||
*/
|
||||
|
||||
'collectors' => [
|
||||
'phpinfo' => true, // Php version
|
||||
'messages' => true, // Messages
|
||||
'time' => true, // Time Datalogger
|
||||
'memory' => true, // Memory usage
|
||||
'exceptions' => true, // Exception displayer
|
||||
'log' => true, // Logs from Monolog (merged in messages if enabled)
|
||||
'db' => true, // Show database (PDO) queries and bindings
|
||||
'views' => true, // Views with their data
|
||||
'route' => true, // Current route information
|
||||
'auth' => false, // Display Laravel authentication status
|
||||
'gate' => true, // Display Laravel Gate checks
|
||||
'session' => true, // Display session data
|
||||
'symfony_request' => true, // Only one can be enabled..
|
||||
'mail' => true, // Catch mail messages
|
||||
'laravel' => false, // Laravel version and environment
|
||||
'events' => false, // All events fired
|
||||
'default_request' => false, // Regular or special Symfony request logger
|
||||
'logs' => false, // Add the latest log messages
|
||||
'files' => false, // Show the included files
|
||||
'config' => false, // Display config settings
|
||||
'cache' => false, // Display cache events
|
||||
'models' => true, // Display models
|
||||
'livewire' => true, // Display Livewire (when available)
|
||||
'jobs' => false, // Display dispatched jobs
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Extra options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Configure some DataCollectors
|
||||
|
|
||||
*/
|
||||
|
||||
'options' => [
|
||||
'time' => [
|
||||
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
|
||||
],
|
||||
'messages' => [
|
||||
'trace' => true, // Trace the origin of the debug message
|
||||
],
|
||||
'memory' => [
|
||||
'reset_peak' => false, // run memory_reset_peak_usage before collecting
|
||||
'with_baseline' => false, // Set boot memory usage as memory peak baseline
|
||||
'precision' => 0, // Memory rounding precision
|
||||
],
|
||||
'auth' => [
|
||||
'show_name' => true, // Also show the users name/email in the debugbar
|
||||
'show_guards' => true, // Show the guards that are used
|
||||
],
|
||||
'db' => [
|
||||
'with_params' => true, // Render SQL with the parameters substituted
|
||||
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
|
||||
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
|
||||
'timeline' => false, // Add the queries to the timeline
|
||||
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
|
||||
'explain' => [ // Show EXPLAIN output on queries
|
||||
'enabled' => false,
|
||||
'types' => ['SELECT'], // Deprecated setting, is always only SELECT
|
||||
],
|
||||
'hints' => false, // Show hints for common mistakes
|
||||
'show_copy' => false, // Show copy button next to the query,
|
||||
'slow_threshold' => false, // Only track queries that last longer than this time in ms
|
||||
'memory_usage' => false, // Show queries memory usage
|
||||
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
|
||||
'hard_limit' => 500, // After the hard limit, queries are ignored
|
||||
],
|
||||
'mail' => [
|
||||
'timeline' => false, // Add mails to the timeline
|
||||
'show_body' => true,
|
||||
],
|
||||
'views' => [
|
||||
'timeline' => false, // Add the views to the timeline (Experimental)
|
||||
'data' => true, //true for all data, 'keys' for only names, false for no parameters.
|
||||
'group' => 50, // Group duplicate views. Pass value to auto-group, or true/false to force
|
||||
'exclude_paths' => [ // Add the paths which you don't want to appear in the views
|
||||
'vendor/filament' // Exclude Filament components by default
|
||||
],
|
||||
],
|
||||
'route' => [
|
||||
'label' => true, // show complete route on bar
|
||||
],
|
||||
'session' => [
|
||||
'hiddens' => [], // hides sensitive values using array paths
|
||||
],
|
||||
'symfony_request' => [
|
||||
'hiddens' => [], // hides sensitive values using array paths, example: request_request.password
|
||||
],
|
||||
'events' => [
|
||||
'data' => false, // collect events data, listeners
|
||||
],
|
||||
'logs' => [
|
||||
'file' => null,
|
||||
],
|
||||
'cache' => [
|
||||
'values' => true, // collect cache values
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Inject Debugbar in Response
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Usually, the debugbar is added just before </body>, by listening to the
|
||||
| Response after the App is done. If you disable this, you have to add them
|
||||
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
||||
|
|
||||
*/
|
||||
|
||||
'inject' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DebugBar route prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Sometimes you want to set route prefix to be used by DebugBar to load
|
||||
| its resources from. Usually the need comes from misconfigured web server or
|
||||
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
||||
|
|
||||
*/
|
||||
'route_prefix' => '_debugbar',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DebugBar route middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Additional middleware to run on the Debugbar routes
|
||||
*/
|
||||
'route_middleware' => [],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DebugBar route domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default DebugBar route served from the same domain that request served.
|
||||
| To override default domain, specify it as a non-empty value.
|
||||
*/
|
||||
'route_domain' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| DebugBar theme
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Switches between light and dark theme. If set to auto it will respect system preferences
|
||||
| Possible values: auto, light, dark
|
||||
*/
|
||||
'theme' => env('DEBUGBAR_THEME', 'auto'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Backtrace stack limit
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By default, the DebugBar limits the number of frames returned by the 'debug_backtrace()' function.
|
||||
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
|
||||
*/
|
||||
'debug_backtrace_limit' => 50,
|
||||
];
|
File diff suppressed because one or more lines are too long
1
public/build/assets/load-more-BlXjt7JF.js
Normal file
1
public/build/assets/load-more-BlXjt7JF.js
Normal file
|
@ -0,0 +1 @@
|
|||
window.lazyFunctions={more:function(a){const n=a,e=JSON.parse(atob(a.dataset.params)),r=new Headers;r.append("Content-Type","application/json"),r.append("Accept","application/json");const o={page:e.page,route:e.route};"genre"in e.route_parameters&&(o.genre=e.route_parameters.genre),"search"in e&&(o.search=e.search);const s={method:"POST",headers:r,body:JSON.stringify(o)};fetch(e.route,s).then(t=>t.json()).then(t=>{const i=a.parentNode;i.innerHTML+=t.html,window.lLoad.update(),a.remove(),document.getElementById(a.getAttribute("id")).remove(),t.has_more_pages&&(e.page=t.current_page+1,n.setAttribute("href",n.getAttribute("href").replace(new RegExp(t.current_page+"$"),t.current_page+1)),n.setAttribute("data-params",btoa(JSON.stringify(e))),n.removeAttribute("data-ll-status"),n.classList.remove("entered"),i.appendChild(n),window.lMore.update())}).catch(t=>console.error(t))}};function c(a){var n=a.getAttribute("data-lazy-function"),e=window.lazyFunctions[n];e&&e(a)}window.lMore=new window.LazyLoad({elements_selector:"#next-page",unobserve_entered:!0,callback_enter:c});
|
|
@ -1 +0,0 @@
|
|||
window.lazyFunctions={more:function(a){const n=a,e=JSON.parse(atob(a.dataset.params)),r=new Headers;r.append("Content-Type","application/json"),r.append("Accept","application/json");const o={page:e.page,route:e.route};"genre"in e.route_parameters&&(o.genre=e.route_parameters.genre);const p={method:"POST",headers:r,body:JSON.stringify(o)};fetch(e.route,p).then(t=>t.json()).then(t=>{const i=a.parentNode;i.innerHTML+=t.html,window.lLoad.update(),a.remove(),document.getElementById(a.getAttribute("id")).remove(),t.has_more_pages&&(e.page=t.current_page+1,n.setAttribute("href",n.getAttribute("href").replace(new RegExp(t.current_page+"$"),t.current_page+1)),n.setAttribute("data-params",btoa(JSON.stringify(e))),n.removeAttribute("data-ll-status"),n.classList.remove("entered"),i.appendChild(n),window.lMore.update())}).catch(t=>console.error(t))}};function s(a){var n=a.getAttribute("data-lazy-function"),e=window.lazyFunctions[n];e&&e(a)}window.lMore=new window.LazyLoad({elements_selector:"#next-page",unobserve_entered:!0,callback_enter:s});
|
|
@ -24,7 +24,7 @@
|
|||
"isEntry": true
|
||||
},
|
||||
"resources/js/load-more.js": {
|
||||
"file": "assets/load-more-D8TQhGMg.js",
|
||||
"file": "assets/load-more-BlXjt7JF.js",
|
||||
"name": "load-more",
|
||||
"src": "resources/js/load-more.js",
|
||||
"isEntry": true
|
||||
|
|
|
@ -18,6 +18,9 @@ window.lazyFunctions = {
|
|||
if ('genre' in params.route_parameters) {
|
||||
postBody.genre = params.route_parameters.genre;
|
||||
}
|
||||
if ('search' in params) {
|
||||
postBody.search = params.search;
|
||||
}
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
headers: myHeaders,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{{-- <div class="col-xxl-2 col-md-3 col-4 col-xs-6 mb-30"> --}}
|
||||
<div class="@if(isset($is_list) && $is_list)col-xxl-2 @else col-xxl-3 @endif col-md-3 col-4 col-xs-6 mb-30">
|
||||
<div class="movie-card" @isset($data_text) data-text="{{ $data_text }}"@else data-text="{{ ucfirst($item['route']) }}" @endisset>
|
||||
<div class="movie-card" @isset($data_text) data-text="{{ $data_text }}"@else data-text="{{ ucfirst($item['route'] ?? $item['type']) }}" @endisset>
|
||||
<div class="movie-card__thumb thumb__2">
|
||||
<img @if($item['image'])class="lazy"@endif width="300" height="450" src="data:image/svg+xml,%3Csvg width='300' height='450' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='300' height='450' x='0' y='0' fill='%231B1B3F' /%3E%3C/svg%3E"" @if($item['image']) data-src="{{$item['image'] }}" @endif alt="{{ str($item['title'])->apa() }}">
|
||||
<a href="{{ route($item['route'], ['id' => $item['id'], 'slug' => $item['slug']]) }}" title="{{ str($item['title'])->apa() }}" class="icon"><i class="fas fa-play"></i></a>
|
||||
<a href="{{ route($item['route'] ?? $item['type'], ['id' => $item['id'], 'slug' => $item['slug']]) }}" title="{{ str($item['title'])->apa() }}" class="icon"><i class="fas fa-play"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
{{-- @vite(['resources/js/jqfix.js']) --}}
|
||||
@vite(['resources/js/app.js'])
|
||||
@yield('footer')
|
||||
@stack('footer')
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
|
|
@ -5,111 +5,45 @@
|
|||
|
||||
<section class="inner-hero bg_img dark--overlay lazy" data-bg="{{asset('images/breadcrumb.webp')}}">
|
||||
<div class="container position-relative">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h2 class="text-center ">{{$meta['title']}}</h2>
|
||||
<ul class="page-breadcrumb d-flex justify-content-center">
|
||||
<li><a href="{{route('home')}}" class="">Home</a></li>
|
||||
<li>{{$meta['title']}}</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h2 class="text-center ">{{$meta['title']}}</h2>
|
||||
<ul class="page-breadcrumb d-flex justify-content-center">
|
||||
<li><a href="{{route('home')}}" class="">Home</a></li>
|
||||
<li>{{$meta['title']}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="pt-80 pb-80">
|
||||
<div class="container-fluid">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-none-30 ajaxLoad">
|
||||
@forelse($data as $item)
|
||||
@forelse($data as $item)
|
||||
@include('components.title_card', ['is_list' => true])
|
||||
@if($loop->last)
|
||||
{{-- {{dd($meta['route']->parameters)}} --}}
|
||||
@if($pagination->hasMorePages())
|
||||
<a href="{{ route($meta['route']->getName(), array_merge($meta['route']->parameters, ['page' => $pagination->currentPage() + 1])) }}" data-params="{{base64_encode(json_encode( ['page' => $pagination->currentPage() + 1,
|
||||
@if($loop->last)
|
||||
@if($pagination->hasMorePages())
|
||||
<a href="{{ route($meta['route']->getName(), array_merge($meta['route']->parameters, ['page' => $pagination->currentPage() + 1])) }}" data-params="{{base64_encode(json_encode( ['page' => $pagination->currentPage() + 1,
|
||||
'route_parameters' => $meta['route']->parameters,
|
||||
'route' => route('api.'.$meta['route']->getName()), 'has_more_pages' => $pagination->hasMorePages() ]))}}" data-lazy-function="more" id="next-page" class="text-center w-10" title="Load More">
|
||||
<img width="120" height="120" src="{{ asset('images/loading.svg') }}" alt="Load More">
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
@empty
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-xs-12 mb-30 mx-auto">
|
||||
<img src="{{ asset('images/no-results.png') }}" alt="No Results">
|
||||
</div>
|
||||
@endforelse
|
||||
<img width="120" height="120" src="{{ asset('images/loading.svg') }}" alt="Load More">
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
@empty
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-xs-12 mb-30 mx-auto">
|
||||
<img src="{{ asset('images/no-results.png') }}" alt="No Results">
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
{{-- {{ $pagination->links('components.paginator', ['route' => ['name' => $meta['route']->getName(), 'params'=> $meta['route']->parameters]]) }} --}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{{-- <div class="card my-4 border-0 shadow">
|
||||
<div class="card-header bg-primary d-flex justify-content-between">
|
||||
<h1 class="fs-5 fw-bold text-white text-uppercase mb-0">{{ $meta['page_title'] ?? $meta['title']}}</h1>
|
||||
@if(!$pagination->onFirstPage())
|
||||
<span class="text-white">Page {{$pagination->currentPage()}}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row row-cols-2 row-cols-sm-4 row-cols-lg-6 row-cols-xl-8 g-4">
|
||||
@foreach ($data as $item)
|
||||
@includeWhen($type == 'movie', 'components.movie_card')
|
||||
@includeWhen($type == 'show', 'components.show_card')
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
{{-- <h1 class="col-span-full mb-1 text-xl font-semibold text-body bg-slate-100 p-3 mt-5 flex justify-between">
|
||||
<span>
|
||||
{{ $meta['title']}}
|
||||
</span>
|
||||
<span class="font-extralight">
|
||||
|
||||
@unless($pagination->onFirstPage()) Page {{ $pagination->currentPage() }} @endunless
|
||||
</span>
|
||||
</h1> --}}
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
@section('footer')
|
||||
<script type="module">
|
||||
// var send = 0;
|
||||
// if ($(window).scrollTop() + $(window).height() > $(document).height() - 60) {
|
||||
// if ($('.ajaxLoad').hasClass('loaded')) {
|
||||
// $('.loading').removeClass('loader');
|
||||
// return false;
|
||||
// }
|
||||
// $('.loading').addClass('loader');
|
||||
// setTimeout(function() {
|
||||
// if (send == 0) {
|
||||
// send = 1;
|
||||
// var url = 'https://script.viserlab.com/playlab/demo/load-more';
|
||||
// var id = $('.data_id').last().data('id');
|
||||
// var category_id = $('.category_id').last().data('category_id');
|
||||
// var subcategory_id = $('.subcategory_id').last().data('subcategory_id');
|
||||
// var search = $('.search').last().data('search');
|
||||
// var data = {
|
||||
// id: id,
|
||||
// category_id: category_id,
|
||||
// subcategory_id: subcategory_id,
|
||||
// search: search
|
||||
// };
|
||||
// $.get(url, data, function(response) {
|
||||
// if (response == 'end') {
|
||||
// $('.loading').removeClass('loader');
|
||||
// $('.footer').removeClass('d-none');
|
||||
// $('.ajaxLoad').addClass('loaded');
|
||||
// return false;
|
||||
// }
|
||||
// $('.loading').removeClass('loader');
|
||||
// $('.sections').append(response);
|
||||
// $('.ajaxLoad').append(response);
|
||||
// send = 0;
|
||||
// });
|
||||
// }
|
||||
// }, 1000);
|
||||
// }
|
||||
</script>
|
||||
|
||||
@endsection
|
||||
@push('footer')
|
||||
@vite(['resources/js/load-more.js'])
|
||||
|
||||
@endpush
|
||||
|
|
|
@ -1,9 +1,55 @@
|
|||
@extends('layouts.layout')
|
||||
|
||||
|
||||
@section('content')
|
||||
@section('app')
|
||||
|
||||
<div class="card my-4 border-0 shadow">
|
||||
<section class="inner-hero bg_img dark--overlay lazy" data-bg="{{asset('images/breadcrumb.webp')}}">
|
||||
<div class="container position-relative">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h2 class="text-center ">{{$meta['title']}}</h2>
|
||||
<ul class="page-breadcrumb d-flex justify-content-center">
|
||||
<li><a href="{{route('home')}}" class="">Home</a></li>
|
||||
<li>Search results for: {{ $query }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="pt-80 pb-80">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-none-30 ajaxLoad">
|
||||
@forelse($data as $item)
|
||||
@include('components.title_card', ['is_list' => true])
|
||||
@if($loop->last)
|
||||
@if($pagination->hasMorePages())
|
||||
<a href="{{ route($meta['route']->getName(), array_merge($meta['route']->parameters, ['page' => $pagination->currentPage() + 1, 'search' => $query])) }}" data-params="{{base64_encode(json_encode( ['page' => $pagination->currentPage() + 1,
|
||||
'route_parameters' => $meta['route']->parameters,
|
||||
'route' => route('api.'.$meta['route']->getName()), 'has_more_pages' => $pagination->hasMorePages(), 'search' => $query ]))}}" data-lazy-function="more" id="next-page" class="text-center w-10" title="Load More">
|
||||
<img width="120" height="120" src="{{ asset('images/loading.svg') }}" alt="Load More">
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
@empty
|
||||
<div class="col-xl-4 col-lg-4 col-md-6 col-sm-12 col-xs-12 mb-30 mx-auto">
|
||||
<img src="{{ asset('images/no-results.png') }}" alt="No Results">
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
|
||||
@push('footer')
|
||||
@vite(['resources/js/load-more.js'])
|
||||
|
||||
@endpush
|
||||
|
||||
|
||||
{{-- <div class="card my-4 border-0 shadow">
|
||||
<div class="card-header bg-primary d-flex justify-content-between">
|
||||
<h1 class="fs-5 fw-bold text-white text-uppercase mb-0">{{ $meta['page_title'] ?? $meta['title']}}</h1>
|
||||
</div>
|
||||
|
@ -13,7 +59,7 @@
|
|||
<span class="text-lg text-white text-center bg-primary py-2 fs-5 fw-semibold rounded">Movies</span>
|
||||
<div class="row row-cols-2 row-cols-sm-4 row-cols-lg-6 row-cols-xl-8 g-4">
|
||||
@foreach ($data['movie'] as $item)
|
||||
@include('components.movie_card')
|
||||
@include('components.title_card')
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,7 +69,7 @@
|
|||
<span class="text-lg text-white text-center bg-primary py-2 fs-5 fw-semibold rounded mt-5">TV Shows</span>
|
||||
<div class="row row-cols-2 row-cols-sm-4 row-cols-lg-6 row-cols-xl-8 g-4">
|
||||
@foreach ($data['show'] as $item)
|
||||
@include('components.show_card')
|
||||
@include('components.title_card')
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,8 +80,8 @@
|
|||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
|
||||
|
||||
@endsection
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
|
||||
use App\Http\Controllers\HomeController;
|
||||
use App\Http\Controllers\MovieController;
|
||||
use App\Http\Controllers\ShowController;
|
||||
use Illuminate\Http\Request;
|
||||
|
@ -22,3 +23,4 @@
|
|||
Route::post('/movies', [MovieController::class, 'movies_more'])->name('api.movies');
|
||||
Route::post('/movies/genre', [MovieController::class, 'movies_genre_more'])->name('api.movies.genre');
|
||||
Route::post('/tv-shows', [ShowController::class, 'shows_more'])->name('api.shows');
|
||||
Route::post('/search', [HomeController::class, 'search_more'])->name('api.search');
|
||||
|
|
2
storage/debugbar/.gitignore
vendored
Normal file
2
storage/debugbar/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
Loading…
Reference in a new issue