title: How can I validate to check if a record having this value exists in a table?
body: <p>I am working on a Laravel project and I have the following problem related to validation.</p>
  <p>In the past I created this validation rules (related to a new user registration form):</p>
  <pre class="lang-php prettyprint-override"><code>$rules = [
      'name' =&gt; 'required',
      'surname' =&gt; 'required',
      'login' =&gt; 'required|unique:pm_user,login',
      'email' =&gt; 'required|email|confirmed|unique:pm_user,email',
      'pass' =&gt; 'required|required|min:6',
      'g-recaptcha-response' =&gt; 'required|captcha',
  ];
  </code></pre>
  <p>In particular this rules array contains this rule:</p>
  <pre><code>'login' =&gt; 'required|unique:pm_user,login',
  </code></pre>
  <p>it seems to me that this last rule check if the inserted login doesn't yet exist into the <strong>pm_user</strong> table (so it ensure that not exist a row of the <strong>pm_user</strong> table having the same inserted value into the <strong>login</strong> column).</p>
  <p>Is it? Correct me if I am doing wrong assertion.</p>
  <p>If it work in this way now my problem is how to do the opposite thing in another set of validation rule.</p>
  <p>In particular I have this other array of rule (defined into a class extending<code>FormRequest</code>:</p>
  <pre class="lang-php prettyprint-override"><code>public function rules() {
      return [
          'email' =&gt; 'required|email',
          'token' =&gt; 'required',
      ];
  }
  </code></pre>
  <p>In particular I have to ensure that into the <strong>pm_user</strong> table yet exist a record having the value of the column named <strong>email</strong> that is the same of the <strong>emai</strong> field of the request.</p>
  <p>How can I change this request to perform this validation rule?</p>