title: Check if relation exist with foreign entity in Laravel / Eloquent
body: <p>I have an instance <code>$person</code> of <code>Person</code> and want to check if there is a relation created to a foreign entity (<code>App</code>).</p>
  
  <pre><code>people: id
  people_apps: person_id, app_id
  apps: id
  </code></pre>
  
  <p>The relationships are properly mapped in the Eloquent models. <strong>What is the preferred way to check this?</strong></p>
  
  <p>The only way I can think of is something like</p>
  
  <pre><code>$foundApp = $person-&gt;apps-&gt;filter(function($a) use($searchAppId)
  { 
    return $a-&gt;id == $searchAppId; 
  });
  
  if ($foundApp) {}
  </code></pre>
  
  <p>but there's probably a better way.</p>