title: Exists validations with multiple tables
body: <p>Laravel version (7.x).</p>
  
  <p>I have three tables <code>companies</code>, <code>complaint_types</code> &amp; <code>complaints</code>.</p>
  
  <p>The complaints are associated with a <code>company</code>. </p>
  
  <p>When a <code>complaint</code> is assigned to an <code>employee</code> then only he/she can see and enter the complaint status after the visit. Before entering the comments the <code>complaint</code> must be validated, otherwise the comment must not be allowed to enter, which is handled upon submitting the form via a hidden field called <code>complaint_id</code>.</p>
  
  <p>I have added this validation because I don't want anyone opening the inspect tool, playing with the values and causing the application an error.</p>
  
  <p>Tables:</p>
  
  <pre><code>companies:  -&gt;  complaint_types:  -&gt;  complaints:
  |-- id          |-- id                |-- id
  |-- ...         |-- company_id        |-- complaint_type_id
                  |-- ...               |-- ...
  </code></pre>
  
  <p><em>Complaint.php:</em></p>
  
  <pre class="lang-php prettyprint-override"><code>public function complaintType()
  {
      return $this-&gt;belongsTo(ComplaintType::class);
  }
  </code></pre>
  
  <p><em>ComplaintType.php:</em></p>
  
  <pre class="lang-php prettyprint-override"><code>public function company()
  {
      return $this-&gt;belongsTo(Company::class);
  }
  
  public function complaints()
  {
      return $this-&gt;hasMany(Complaint::class);
  }
  </code></pre>
  
  <p><em>ComplaintController.php:</em></p>
  
  <pre class="lang-php prettyprint-override"><code>private function validate($data)
  {
      # variables
      $rules = [
          'complaint_id' =&gt; [
              'required', 
              'exists:complaints,id,complaintType.company_id,' . session()-&gt;get('COMPANY')
          ],
  
          -- OR --
  
          'complaint_id' =&gt; [
              'required', 
              'exists:complaints,id,complaint_types.company_id,' . session()-&gt;get('COMPANY')
          ],
  
          ...
      ];
  
      $messages = [
          'complaint_id.required' =&gt; '`Complaint` - Required&lt;br&gt;',
          'complaint_id.exists'   =&gt; '`Complaint` could not be identifed&lt;br&gt;',
  
           ...
      ];
  
      return Validator::make($data, $rules, $messages);
  }
  </code></pre>
  
  <p><strong>Error</strong><br>
  <code>Column not found: 1054 Unknown column 'complaintType.company_id' in 'where clause' (SQL: SELECT COUNT(*) as aggregate FROM complaints WHERE id = 3 AND complaintType.company_id = 1)</code></p>