Laravel 5 – Form Validation of array of input elements

I have been using Laravel latelly. A problem that i had to overcome was using the validation mechanism of Laravel
for validating a variable number of form elements.

I made a dynamic form that someone could add many email input elements with name=’email[]’

The solution to validate each and everyone of these elements was not obvious and after some searching in the framework
the following code in the controller worked:

        $validator = Validator::make($request->all(), [
            'email' => 'array' //i declare the email as an array of elements
        ]);

        $validator->each('email', ['email']); //Here i declare the rules that will be executed for each elements in the array

        if ($validator->fails()) {
            return redirect('mycontroller/edit/'.$id)
                        ->withErrors($validator)
                        ->withInput();
        }

Cheers!