mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-11 05:59:57 -06:00
- github action updated with new ruleset in pint.json - codebase linted with new ruleset - contributors can now run `./vendor/bin/pint` - action workflow will auto correct any lint issues upon commit/opened pull request
73 lines
2.2 KiB
PHP
73 lines
2.2 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
*
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Movie extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
public $table = 'movie';
|
|
|
|
public function genres(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Genre::class);
|
|
}
|
|
|
|
public function cast(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Cast::class, 'cast_movie', 'cast_id', 'movie_id');
|
|
}
|
|
|
|
public function crew(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Crew::class, 'crew_movie', 'person_id', 'movie_id');
|
|
}
|
|
|
|
public function companies(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Company::class);
|
|
}
|
|
|
|
public function countries(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Company::class);
|
|
}
|
|
|
|
public function collection(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Collection::class)->take(1);
|
|
}
|
|
|
|
public function recommendations(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(Recommendation::class, 'movie_id', 'id');
|
|
}
|
|
|
|
public function torrents(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(Torrent::class, 'tmdb', 'id')->whereHas('category', function ($q): void {
|
|
$q->where('movie_meta', '=', true);
|
|
});
|
|
}
|
|
|
|
public function requests(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(TorrentRequest::class, 'tmdb', 'id')->whereHas('category', function ($q): void {
|
|
$q->where('movie_meta', '-', true);
|
|
});
|
|
}
|
|
}
|