laravel-validated-dto icon indicating copy to clipboard operation
laravel-validated-dto copied to clipboard

How to access request input during validating?

Open gavinliu6 opened this issue 1 month ago • 0 comments

Hi, @WendellAdriel

When writing validation rules inside a DTO, sometimes I need to refer to other fields. How can I access them — or, in other words, how can I access the $request? Like this:

[
    'role_id' => Rule::requiredIf($request->user()->is_admin),
]

gavinliu6 avatar Nov 05 '25 08:11 gavinliu6