lots of progress

This commit is contained in:
2025-01-26 21:36:05 +02:00
parent bbd082fd8f
commit 6a014c403c
44 changed files with 976 additions and 104 deletions
+22 -1
View File
@@ -28,6 +28,17 @@ class Movie extends Model
'vote_count',
];
protected $casts = [
'release_date' => 'date'
];
public function director()
{
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id')
->where('movie_cast.known_for_department', 'Directing')
;
}
public function collections()
{
return $this->belongsToMany(MovieCollection::class, 'movies_in_collection', 'movie_id', 'collection_id');
@@ -40,7 +51,7 @@ class Movie extends Model
public function castList()
{
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id');
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id')->withPivot('known_for_department', 'character', 'order');
}
public function crewList()
@@ -72,4 +83,14 @@ class Movie extends Model
{
return $this->belongsToMany(Video::class, 'movie_videos', 'movie_id', 'video_id');
}
public function productionCompanies()
{
return $this->belongsToMany(ProductionCompany::class, 'movie_production_companies', 'movie_id', 'production_company_id');
}
public function productionCountries()
{
return $this->belongsToMany(ProductionCountry::class, 'movie_production_countries', 'movie_id', 'production_country_id');
}
}