*/ protected $fillable = [ 'room_id', 'idiom_id', 'status', 'reward_gold', 'reward_exp', 'winner_id', 'winner_username', 'started_at', 'ended_at', ]; /** * 方法功能:定义回合字段的类型转换规则。 * * @return array */ 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); } }