完善猜成语过期与答题记录逻辑
This commit is contained in:
@@ -15,8 +15,16 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 类功能:记录猜成语每一轮的题目、奖励与结算状态。
|
||||
*/
|
||||
class IdiomGameRound extends Model
|
||||
{
|
||||
/**
|
||||
* 方法功能:声明可批量赋值的回合字段。
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'room_id',
|
||||
'idiom_id',
|
||||
@@ -29,6 +37,11 @@ class IdiomGameRound extends Model
|
||||
'ended_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* 方法功能:定义回合字段的类型转换规则。
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
@@ -39,6 +52,9 @@ class IdiomGameRound extends Model
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法功能:关联本回合对应的成语题目。
|
||||
*/
|
||||
public function idiom(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Idiom::class);
|
||||
|
||||
Reference in New Issue
Block a user