json(['valid' => true]); } /** * @return array */ public function rules(): array { return app(ContributionFactory::class)->rules(request()->type); } public function prepareForValidation(ActionRequest $request): void { static::validateType($request->input('type')); } public static function validateType(?string $type = null): void { Validator::make(['type' => $type], app(ContributionFactory::class)->typeRule())->validate(); } }