title: Display Error Message for Custom Validation in Laravel 4
body: <p>I have created a custom error function by creating a class;</p>
  
  <pre><code>&lt;?php
  
  class CoreValidator extends Illuminate\Validation\Validator
  {
      public function validatePostcode($attribute, $value, $parameters = null)
      {
          $regex = "/^((GIR 0AA)|((([A-PR-UWYZ][0-9][0-9]?)|(([A-PR-UWYZ][A-HK-Y][0-9][0-9]?)|(([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY])))) [0-9][ABD-HJLNP-UW-Z]{2}))$/i";
          if(preg_match($regex ,$value)) {
              return true;
          }
          return false;
      }
  }
  </code></pre>
  
  <p>I reference it in my model;</p>
  
  <pre><code>public static $rules = array(
          'first_name' =&gt; 'required|Max:45',
          'surname' =&gt; 'required|Max:45',
          'address_line_1' =&gt; 'required|Max:255',
          'address_line_2' =&gt; 'Max:255',
          'address_line_3' =&gt; 'Max:255',
          'town' =&gt; 'required|Max:45',
          'county' =&gt; 'Max:45',
          'postcode' =&gt; 'required|Postcode',
          'phone_number' =&gt; 'required|Max:22'
      );
  </code></pre>
  
  <p>It has been registered in my <strong>global.php</strong>;</p>
  
  <pre><code>Validator::resolver(function($translator, $data, $rules, $messages) {
          return new CoreValidator($translator, $data, $rules, $messages);
      });
  </code></pre>
  
  <p>It all works well, but the error message it returns is </p>
  
  <blockquote>
    <p>validation.postcode</p>
  </blockquote>
  
  <p>How/where do I set a custom error message for this?<br />
  I have tried setting <strong>app/lang/en/validation.php</strong> with (neither work);</p>
  
  <pre><code>'custom' =&gt; array(
          "validation.postcode" =&gt; "my error message 1",
          "postcode" =&gt; "my error message 2"
      )
  </code></pre>
  
  <p>P.S. I know that there is a regex validation method already, but this problem is more generic for me.</p>