0

Laravel Help with validation Hi everyone I want to validate an array of a foreign key to make sure it exists I am doing

'activities'    => 'required|array',
'activities.*' => 'exists:admin_activities,id',

but it's skipping this validation

any solution for this

1 Answer 1

1

You can validate each element of an array in Laravel with "dot notation" to For example, to validate that each id in a given array input field is exists in admin_activities , you may do the following:

'activities.*.id' => 'required|exists:admin_activities,id',
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.