['nullable', 'regex:/^\d{4}-\d{2}$/'], ]; } /** * Custom attribute names */ public function attributes(): array { return [ 'year_month' => __('validation.attributes.year_month'), ]; } /** * Custom validation messages */ public function messages(): array { return [ 'year_month.regex' => __('validation.date_format', ['format' => 'YYYY-MM']), ]; } }