In this short post, I will show you how to use the Lumen/Laravel validation to validate multiple images in an array.
1. Make sure you are posting an array of images to your endpoint
images[]
In Postman or whatever testing tool you use, make sure you POST an array of images, not just a single one.
2. Use the following code to check that the request contains an array of images and validate each one of them
$this->validate($request, [ 'images' => 'array', 'images.*' => 'mimes:png,jpeg,jpg|max:8000' ]);
Learn more: Laravel – Validation
How to solve – No ‘Access-Control-Allow-Origin’ header is present on the requested resource
This does not working for me. Laravel 5.7.