Files

25 lines
447 B
PHP
Raw Permalink Normal View History

2024-12-30 22:41:34 +02:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class MediaListItem extends Model
{
protected $fillable = [
'media_list_id',
'item_id',
'item_type',
'tmdb_id',
];
2025-02-01 15:31:47 +02:00
public function item()
{
if ($this->item_type == 'movie') {
return $this->hasOne(Movie::class, 'id', 'item_id');
}
return $this->hasOne(Show::class, 'id', 'item_id');
}
2024-12-30 22:41:34 +02:00
}