|string> */ public function rules(): array { return [ 'member_id' => ['nullable', 'exists:members,id'], 'title' => ['required', 'string', 'max:255'], 'amount' => ['required', 'numeric', 'min:0'], 'description' => ['nullable', 'string'], 'attachment' => ['nullable', 'file', 'max:10240'], // 10MB max ]; } /** * Get custom messages for validator errors. * * @return array */ public function messages(): array { return [ 'title.required' => '請輸入標題', 'title.max' => '標題不得超過 255 字', 'amount.required' => '請輸入金額', 'amount.numeric' => '金額必須為數字', 'amount.min' => '金額不得為負數', 'attachment.max' => '附件大小不得超過 10MB', ]; } }