1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-15 14:42:31 +01:00
flox/backend/app/Item.php
devfake c901232f16 start file parser
migrations

swap sqlite file with memory

set and update alternative titles

simplify alternative titles

change request limit handling

move limitRemaining to method
2017-02-13 21:17:25 +01:00

45 lines
876 B
PHP

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;
class Item extends Model {
// Uncomment this if you are using Laravel Scout.
//use Searchable;
public $timestamps = false;
protected $fillable = [
'tmdb_id',
'title',
'original_title',
'poster',
'media_type',
'rating',
'released',
'created_at',
'genre',
];
public function episodes()
{
return $this->hasMany(Episode::class, 'tmdb_id', 'tmdb_id');
}
public function alternativeTitles()
{
return $this->hasMany(AlternativeTitle::class, 'tmdb_id', 'tmdb_id');
}
public function latestEpisode()
{
return $this->hasOne(Episode::class, 'tmdb_id', 'tmdb_id')
->orderBy('id', 'desc')
->where('seen', true)
->latest();
}
}