title: Laravel, check if data/record exists in any related table
body: <p>Maybe someone will help me.</p>
  
  <p>DB structure:</p>
  
  <pre><code>users
  id, name
  
  storage_items
  id, name, user_id
  
  archive_objects
  id, name, user_id
  </code></pre>
  
  <p>In User model i have:</p>
  
  <pre><code>public function storageItem()
  {
      return $this-&gt;hasOne(StorageItem::class);
  }
  
  public function archiveObject()
  {
      return $this-&gt;hasOne(ArchiveObject::class);
  }
  </code></pre>
  
  <p>I need check if data/record exists in any related table.</p>
  
  <p>Something like this:</p>
  
  <pre><code>if (User::has('storageItem')-&gt;orHas('archiveObject')-&gt;find(1)-&gt;count()) {
      //exists
  }
  </code></pre>
  
  <p>This works:</p>
  
  <pre><code>if (User::has('storageItem')-&gt;find(1)-&gt;count()) {
      //exists
  }
  </code></pre>
  
  <p>and this too:</p>
  
  <pre><code>if (User::has('archiveObject')-&gt;find(1)-&gt;count()) {
      //exists
  }
  </code></pre>
  
  <p>but that are two queries, i need one beautiful query :)</p>
  
  <p>As a result, i need that when i click button "Delete user", before deleting, i check if data/record exists in any related table, if true, it will show warning message about deleting related data/record (from storage_items or archive_objects), else it will delete just user (from users). </p>