title: Laravel: Validation unique on update
body: <p>I know this question has been asked many times before but no one explains how to get the id when you're validating in the model.</p>
  
  <pre><code>'email' =&gt; 'unique:users,email_address,10'
  </code></pre>
  
  <p>My validation rule is in the model so how do I pass the ID of the record to the validation rule.</p>
  
  <p>Here is my models/User</p>
  
  <pre><code>protected $rules_update = [
      'email_address' =&gt; 'required|email|unique:users,email_address,'.$id,
      'first_name' =&gt; "required",
      'last_name' =&gt; "required",
      'password' =&gt; "required|min:6|same:password_confirm",
      'password_confirm' =&gt; "required:min:6|same:password",
      'password_current' =&gt; "required:min:6"
  ];
  </code></pre>
  
  <p>models/BaseModel</p>
  
  <pre><code>    protected $rules = array();
  
  public $errors;
  
  /*
      * @data: array, Data to be validated
      * @rules: string, rule name in model 
  */
  
  public function validate($data, $rules = "rules") {
  
      $validation  = Validator::make($data, $this-&gt;$rules);
  
      if($validation-&gt;passes()) {
          return true;
      }
  
      $this-&gt;errors = $validation-&gt;messages();
  
      return false;
  }
  </code></pre>