In CustomFormRequest i have something like this:
public function rules(): array
{
return [
'events' => ['array'],
'events.*.type' => ['required'],
'events.*.data' => [app(SomeRule::class)],
];
}
SomeRule:
public function passes($attribute, $value): bool
{
var_dump($attribute);//events.0.data
var_dump($value);exit;
}
In SomeRule::passes i need to have access to events.X.type (so for events.5.data i need events.5.type). Any ideas?
request()to get your dataevents.0.data. Is better way to do that thanexplode?'events.*' => [app(SomeRule::class)],and then$valueshould have both type and data (maybe, I don't know if it will work)