71 lines
1.7 KiB
PHP
71 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Movie extends Model
|
|
{
|
|
protected $fillable = [
|
|
'tmdb_id',
|
|
'adult',
|
|
'runtime',
|
|
'backdrop_path',
|
|
'budget',
|
|
'revenue',
|
|
'homepage',
|
|
'imdb_id',
|
|
'status',
|
|
'original_language',
|
|
'original_title',
|
|
'title',
|
|
'slug',
|
|
'overview',
|
|
'tagline',
|
|
'poster_path',
|
|
'release_date',
|
|
'vote_average',
|
|
'vote_count',
|
|
];
|
|
|
|
public function collections()
|
|
{
|
|
return $this->belongsToMany(MovieCollection::class, 'movies_in_collection', 'movie_id', 'collection_id');
|
|
}
|
|
|
|
public function genres()
|
|
{
|
|
return $this->belongsToMany(Genre::class, 'movie_genres', 'movie_id', 'genre_id');
|
|
}
|
|
|
|
public function castList()
|
|
{
|
|
return $this->belongsToMany(Person::class, 'movie_cast', 'movie_id', 'person_id');
|
|
}
|
|
|
|
public function crewList()
|
|
{
|
|
return $this->belongsToMany(Person::class, 'movie_crew', 'movie_id', 'person_id');
|
|
}
|
|
|
|
public function images()
|
|
{
|
|
return $this->belongsToMany(Image::class, 'movie_images', 'movie_id', 'image_id');
|
|
}
|
|
|
|
public function keywords()
|
|
{
|
|
return $this->belongsToMany(Keyword::class, 'movie_keywords', 'movie_id', 'keyword_id');
|
|
}
|
|
|
|
public function releaseDates()
|
|
{
|
|
return $this->belongsToMany(ReleaseDate::class, 'movie_release_dates', 'movie_id', 'release_date_id');
|
|
}
|
|
|
|
public function watchProviders()
|
|
{
|
|
return $this->belongsToMany(WatchProvider::class, 'movie_watch_providers', 'movie_id', 'watch_provider_id');
|
|
}
|
|
}
|