Files
UNIT3D-Community-Edition/app/Models/Season.php
HDVinnie 472c820f99 update: UNIT3D linting
- 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
2023-02-02 08:02:34 -05:00

62 lines
1.7 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): void {
$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, 'crew_season', 'person_id', 'season_id');
}
}