47 lines
921 B
PHP
47 lines
921 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 文件功能:猜成语游戏回合模型
|
||
|
|
*
|
||
|
|
* 每次出题对应一个回合,记录题目、状态、奖励和获胜者。
|
||
|
|
*
|
||
|
|
* @author ChatRoom Laravel
|
||
|
|
*
|
||
|
|
* @version 1.0.0
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class IdiomGameRound extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'room_id',
|
||
|
|
'idiom_id',
|
||
|
|
'status',
|
||
|
|
'reward_gold',
|
||
|
|
'reward_exp',
|
||
|
|
'winner_id',
|
||
|
|
'winner_username',
|
||
|
|
'started_at',
|
||
|
|
'ended_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'reward_gold' => 'integer',
|
||
|
|
'reward_exp' => 'integer',
|
||
|
|
'started_at' => 'datetime',
|
||
|
|
'ended_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function idiom(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Idiom::class);
|
||
|
|
}
|
||
|
|
}
|