完善猜成语过期与答题记录逻辑

This commit is contained in:
pllx
2026-04-29 10:32:12 +08:00
parent 2f9b2eed64
commit 5962d6d2b3
11 changed files with 685 additions and 115 deletions
+16
View File
@@ -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);