44 lines
892 B
PHP
44 lines
892 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||
|
|
|
||
|
|
class Game extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'igdb_id',
|
||
|
|
'name',
|
||
|
|
'summary',
|
||
|
|
'storyline',
|
||
|
|
'cover_url',
|
||
|
|
'slug',
|
||
|
|
'first_release_date',
|
||
|
|
'rating',
|
||
|
|
'rating_count',
|
||
|
|
'category',
|
||
|
|
'status',
|
||
|
|
'url',
|
||
|
|
'version_title',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'first_release_date' => 'date',
|
||
|
|
'rating' => 'float',
|
||
|
|
'rating_count' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
public function genres(): BelongsToMany
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Genre::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function platforms(): BelongsToMany
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(Platform::class);
|
||
|
|
}
|
||
|
|
}
|