Files
cleargame/app/Models/Game.php
T

44 lines
892 B
PHP
Raw Normal View History

2025-04-09 23:03:16 +03:00
<?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);
}
}