= 10)才可以自己建房 // 具体阈值可以根据运营需求调整,此处暂设 10 为门槛。 return Auth::check() && Auth::user()->user_level >= 10; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'name' => ['required', 'string', 'max:50', 'unique:rooms,name'], 'description' => ['nullable', 'string', 'max:255'], ]; } public function messages(): array { return [ 'name.required' => '必须填写房间名称。', 'name.unique' => '该房间名称已被占用。', 'name.max' => '房间名称最多 50 个字符。', ]; } }