generated from liutk/owl-admin-base
36 lines
666 B
PHP
36 lines
666 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use EloquentFilter\Filterable;
|
|
|
|
class UserGame extends Model
|
|
{
|
|
use HasFactory, Filterable;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'activity_id',
|
|
'game_id',
|
|
'score',
|
|
'is_right'
|
|
];
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function activity()
|
|
{
|
|
return $this->belongsTo(Activity::class, 'activity_id');
|
|
}
|
|
|
|
public function game()
|
|
{
|
|
return $this->belongsTo(ActivityGame::class, 'game_id');
|
|
}
|
|
}
|