route()->getActionMethod(); $rules = array(); if (in_array($actionMethod, [ 'statisticKeywordsByMonth', 'statisticRevenuesByMonth' ])) { $rules = [ 'timezone_offset' => [ 'required', new TimezoneOffsetRule, ], 'month' => [ 'integer', 'between:1,12', ], 'year' => [ 'integer' ], ]; } return $rules; } /** * Determine if the user is authorized to make this request. */ public function authorize(): bool { return true; } }