user() !== null; } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { $rules = [ 'report_period_id' => ['required', 'integer', 'exists:report_periods,id'], 'department_id' => ['required', 'integer', 'exists:departments,id'], 'values' => ['required', 'array'], ]; foreach (FundingSource::cases() as $fundingSource) { foreach (ExpenseCategory::cases() as $expenseCategory) { $rules["values.{$fundingSource->value}.{$expenseCategory->value}"] = ['nullable', 'numeric', 'min:0']; } } return $rules; } }