title: laravel - how to create custom message bag, errors array
body: <p>i am trying to make custom message bag but unable to make, i want to use the $errors </p>
  
  <pre><code>$errorMsgs = [];
      if (Model::where('name', '=', Input::get('name'))-&gt;exists()) {
         $errorMsgs['company_name'] = 'name already exists';
  
      }else if (Model::where('age', '=', Input::get('age'))-&gt;exists()) {
          $errorMsgs['primary_phone'] = 'age no already exists';
  
      }else if (Model::where('mobile', '=', Input::get('mobile'))-&gt;exists()) {
          $errorMsgs['primary_mobile'] = 'mobile already exists';
  
      }else if (Model::where('pri_email', '=', Input::get('primary_email'))-&gt;exists()) {
          $errorMsgs['primary_email'] = 'Primary email already exists';
  
      }else{
  // success 
  
  
          }
  </code></pre>
  
  <p>Actually i want to use errors foreach </p>
  
  <pre><code> @if ($errors-&gt;any())
                 &lt;div class="alert alert-danger"&gt;
                     &lt;ul&gt;
                         @foreach ($errors-&gt;all() as $error)
                             &lt;li&gt;{{ $error }}&lt;/li&gt;
                         @endforeach
                     &lt;/ul&gt;
                 &lt;/div&gt;
             @endif
  </code></pre>