title: Receive an array of custom error message blade laravel (Array to string conversion)
body: <p>I'm trying to get an array of the custom error message in view for specific filed  </p>
  
  <p><strong>controller</strong></p>
  
  <pre><code>$rules = ['user_Name' =&gt; 'required|max:40',
                'image' =&gt; 'required',
                'image.*' =&gt; 'image|mimes:jpeg,png,jpg,svg,bmp|max:8000',
               ];
  
   // To get name of all image file and display in it in error message 
      if($request-&gt;hasfile('image')){  
        $validationArrayImage = array(); 
        $validationArraySize = array();
        $validationArrayType = array();;
  
        foreach($request-&gt;imageas $key =&gt; $file){           
  
          // check file extension for image type
          if($file-&gt;getClientOriginalExtension() != 'jpeg' &amp;&amp;
             $file-&gt;getClientOriginalExtension() != 'png' &amp;&amp; 
             $file-&gt;getClientOriginalExtension() != 'jpg' &amp;&amp;
             $file-&gt;getClientOriginalExtension() != 'svg' &amp;&amp;
             $file-&gt;getClientOriginalExtension() != 'bmp'){
  
  
             $validationArrayImage['image.'.$key.'.image'] = 'The ' .  $file-&gt;getClientOriginalName() . ' not an image file.';
             $validationArrayType['image.'.$key.'.mimes'] = 'The ' .  $file-&gt;getClientOriginalName() . ' must be a file of type: jpeg, png, jpg, svg, bmp.';
  
          }
  
          // check file size for image size
          if($file-&gt;getSize() &gt;= 8000000){
  
               $validationArraySize['image.'.$key.'.max'] = 'The ' .  $file-&gt;getClientOriginalName() . ' may not be greater than 8 Megabytes.';
             }
  
        }
  
  
  
        // check names array if it empty or not
        if(!empty($validationArrayType) || !empty($validationArraySize) || !empty($validationArrayImage)){
  
          // but all names in custom error, message 
  
         $messages = [
               $validationArrayImage,
               $validationArrayType,
               $validationArraySize,
                ];
         //dd($messages);
        }   
  
      } 
  
  
  
   if(!empty($messages)){
                $result = Validator::make($request-&gt;all(), $rules, $messages);
                /*foreach ($messages as $message) {
                  dump($message);                     &lt;--- Here I can see the array 
               }
              dd("stop");*/
  
             }
             else{ 
                 $result = Validator::make($request-&gt;all(), $rules);
                  //dd('$result');
             }
  </code></pre>
  
  <p>In the dump function, I can see all custom messages but why I get their empty array?
  <a href="https://i.stack.imgur.com/jG75i.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jG75i.png" alt="enter image description here"></a> </p>
  
  <p>I have try this but I got <code>error exception Array to string conversion</code></p>
  
  <pre><code>               if(!empty($messages)){
                $result = Validator::make($request-&gt;all(), $rules, $messages);
                $errors = $result-&gt;errors();
                foreach ($errors-&gt;get('image.*') as $message) {
                  dump($message);
              }
              dd("stop");
                 //dd($result);
             }
             else{ 
                 $result = Validator::make($request-&gt;all(), $rules);
                  //dd('$result');
             }
  </code></pre>
  
  <p>In balde I have to try to get all message in the array but also I got <code>error exception Array to string conversion</code>
  <strong>View balde</strong></p>
  
  <pre><code>                        &lt;!-- To get error message for multi file --&gt;
                          @if (!empty($messages)))
                          &lt;h1&gt;There is an error in your input array&lt;/h1&gt;
                          &lt;ul&gt;
                              @foreach($messages as $errors)
                              @foreach($errors as $error)
                              &lt;li&gt;{{ $error }}&lt;/li&gt;
                              @endforeach
                              @endforeach
                          &lt;/ul&gt;
                          @else
                          &lt;strong&gt;Not array&lt;/strong&gt;
                          @endif
  </code></pre>
  
  <p>Also, I have try this with the same error <code>error exception Array to string conversion</code></p>
  
  <pre><code>&lt;!-- To get error message for multi  --&gt;
                              @if ($errors-&gt;has('Bank_Logo.*'))
                              &lt;span class="invalid-feedback" style="display: block;" role="alert"&gt;
                                  @foreach($errors-&gt;get('Bank_Logo.*') as $errors)
                                  @foreach($errors as $error)
                                  &lt;strong&gt;{{ $error }}&lt;/strong&gt;
                                  @endforeach
                                  @endforeach
                              &lt;/span&gt;
                              @endif
  </code></pre>
  
  <p>I'm trying to get all error messages with the error name for each file.</p>
  
  <p><strong>Any I idea how to get all error message array to view ?</strong> </p>
  
  <p>Laravel version 5.8 </p>