myvideogamelist.com/app/Models/GameList.php

58 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class GameList extends Model
{
use HasFactory;
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'user_id',
'game_id',
'name',
'platform_id',
'ownership',
'status',
'rating',
'priority',
'difficulty',
'hours_played',
'replay_value',
'start_date',
'finish_date',
'is_replaying',
'notes',
'ip_address'
];
/**
* Game list relation to user model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function user()
{
return $this->hasOne(User::class);
}
/**
* Game list relation to game model
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function game()
{
return $this->hasOne(Game::class, 'id', 'game_id');
}
}