diff --git a/app/Console/Commands/TmdbFetch/FetchExportCommand.php b/app/Console/Commands/TmdbFetch/FetchExportCommand.php index a3fad2e..f01d948 100644 --- a/app/Console/Commands/TmdbFetch/FetchExportCommand.php +++ b/app/Console/Commands/TmdbFetch/FetchExportCommand.php @@ -56,12 +56,15 @@ class FetchExportCommand extends Command private function downloadFile($url, $path): void { + echo "Downloading file at ".$url."\n"; $newFileName = $path; $file = fopen ($url, 'rb'); $newFile = null; if ($file) { + echo "Starting download ".$url."\n"; $newFile = fopen ($newFileName, 'wb'); if ($newFile) { + echo "in progress ".$url."\n"; while(!feof($file)) { fwrite($newFile, fread($file, 1024 * 8), 1024 * 8); } diff --git a/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php b/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php index 0742ad3..b27f876 100644 --- a/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php +++ b/app/Console/Commands/TmdbFetch/FetchExportItemsCommand.php @@ -22,7 +22,7 @@ class FetchExportItemsCommand extends Command * * @var string */ - protected $description = 'Fetch TMDB items from export file. Types: movie/show'; + protected $description = 'Fetch TMDB items from export file. Types: movie/tv_series'; /** * Execute the console command. @@ -42,7 +42,7 @@ class FetchExportItemsCommand extends Command $path = storage_path('/'.$type."*"); $file = glob($path); - return reset($file); + return end($file); } private function processItems($gzOpenedFile, string $type) diff --git a/app/Http/Controllers/ShowController.php b/app/Http/Controllers/ShowController.php index 74bec62..a7e0220 100644 --- a/app/Http/Controllers/ShowController.php +++ b/app/Http/Controllers/ShowController.php @@ -28,7 +28,27 @@ class ShowController extends Controller public function season(string $slug, int $seasonNumber) { + $show = Show::with('posters', 'backdrops', 'externalIds', 'networks', 'genres', 'productionCompanies')->where('slug', $slug)->first(); + if (!$show) { + abort(404); + } + + $seasons = Season::where('show_id', $show->id)->orderBy('season_number', 'ASC')->get(); + $currentSeason = Season::where('show_id', $show->id)->where('season_number', $seasonNumber)->first(); + + if (!$currentSeason) { + abort(404); + } + + $episodes = \App\Models\Episode::where('show_id', $show->id) + ->where('season_id', $currentSeason->id) + ->orderBy('episode_number', 'ASC') + ->get(); + + $comments = []; + + return view('show.season', compact('show', 'seasons', 'currentSeason', 'episodes', 'comments')); } public function episode(string $slug, int $seasonNumber, int $episodeNumber) diff --git a/app/Livewire/MoviePage/Recommendations.php b/app/Livewire/MoviePage/Recommendations.php index 41ad06e..be77488 100644 --- a/app/Livewire/MoviePage/Recommendations.php +++ b/app/Livewire/MoviePage/Recommendations.php @@ -18,6 +18,6 @@ class Recommendations extends Component public function mount() { - $this->recommendations = Movie::whereIn('id', MovieRecommendation::where('movie_id', $this->movie->id)->pluck('recommended_movie_id'))->get(); + $this->recommendations = $this->movie->recommendations; } } diff --git a/app/Livewire/MoviePage/Similar.php b/app/Livewire/MoviePage/Similar.php index cf53c6d..d4ca15d 100644 --- a/app/Livewire/MoviePage/Similar.php +++ b/app/Livewire/MoviePage/Similar.php @@ -18,9 +18,6 @@ class Similar extends Component public function mount() { - $this->similarMovies = Movie::whereIn( - 'id', - MovieSimilar::where('movie_id', $this->movie->id)->pluck('similar_movie_id') - )->get(); + $this->similarMovies = $this->movie->similar; } } diff --git a/app/Models/Movie.php b/app/Models/Movie.php index 4173db4..791ea50 100644 --- a/app/Models/Movie.php +++ b/app/Models/Movie.php @@ -131,4 +131,14 @@ class Movie extends Model { return $this->belongsToMany(ProductionCountry::class, 'movie_production_countries', 'movie_id', 'production_country_id'); } + + public function similar() + { + return $this->belongsToMany(Movie::class, 'movie_similars', 'movie_id', 'similar_movie_id'); + } + + public function recommendations() + { + return $this->belongsToMany(Movie::class, 'movie_recommendations', 'movie_id', 'recommended_movie_id'); + } } diff --git a/resources/views/celebrity/index.blade.php b/resources/views/celebrity/index.blade.php index eda78a6..1fe619d 100644 --- a/resources/views/celebrity/index.blade.php +++ b/resources/views/celebrity/index.blade.php @@ -1,51 +1,52 @@ @extends('layouts.app') @section('content') -
- {{ $celebrity->biography }} -
+ + ++ Birthday: {{ $celebrity->birtday }} + @if($celebrity->palce_of_birth) ({{ $celebrity->palce_of_birth }}) @endif +
+ @endif + @if($celebrity->deathday) ++ Deathday: {{ $celebrity->deathday }} +
+ @endif +{{ $celebrity->biography }}
+- Also known as: - @foreach(json_decode($celebrity->also_known_as ?? "{}", true) as $alsoKnown) - {{ $alsoKnown }} - @if(!$loop->last), @endif - @endforeach -
++ @foreach(json_decode($celebrity->also_known_as ?? "{}", true) as $alsoKnown) + {{ $alsoKnown }}@if(!$loop->last), @endif + @endforeach +
+