'integer', 'state_version' => 'integer', 'revealed_at' => 'immutable_datetime', 'deck_config' => 'array', ]; } protected static function booted() { static::creating(function (Room $room) { $room->join_code ??= static::generateJoinCode(); }); } private static function generateJoinCode(): string { $alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; do { $code = ''; for ($i = 0; $i < 6; $i++) { $code .= $alphabet[random_int(0, strlen($alphabet) - 1)]; } } while (static::where('join_code', $code)->exists()); return $code; } public function players(): HasMany { return $this->hasMany(Player::class); } public function votes(): HasMany { return $this->hasMany(Vote::class); } }