mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-11 22:19:47 -06:00
62 lines
1.6 KiB
PHP
62 lines
1.6 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 Season extends Model
|
|
{
|
|
protected $guarded = [];
|
|
|
|
public $timestamps = false;
|
|
|
|
public $table = 'seasons';
|
|
|
|
/**
|
|
* Has Many Torrents.
|
|
*/
|
|
public function torrents(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(Torrent::class, 'tmdb', 'tv_id')->whereHas('category', function ($q) {
|
|
$q->where('tv_meta', '=', true);
|
|
});
|
|
}
|
|
|
|
public function tv(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
{
|
|
return $this->belongsTo(Tv::class);
|
|
}
|
|
|
|
public function episodes(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
{
|
|
return $this->hasMany(Episode::class)
|
|
->oldest('episode_number');
|
|
}
|
|
|
|
public function person(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Person::class);
|
|
}
|
|
|
|
public function cast(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Cast::class);
|
|
}
|
|
|
|
public function crew(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Crew::class);
|
|
}
|
|
}
|