16 lines
619 B
PHP
16 lines
619 B
PHP
<?php
|
|||
|
|
namespace App\Models;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class UserGame extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = ['user_id','game_id','status','rating','start_date','finish_date','hours_played','notes','is_private'];
|
||
|
|
protected $casts = ['start_date'=>'date','finish_date'=>'date','is_private'=>'boolean'];
|
||
|
|
|
||
|
|
const STATUSES = ['playing','played','want_to_play','on_hold','dropped'];
|
||
|
|
|
||
|
|
public function user(): BelongsTo { return $this->belongsTo(User::class); }
|
||
|
|
public function game(): BelongsTo { return $this->belongsTo(Game::class); }
|
||
|
|
}
|