title: Check If Model Exists
body: <p>When searching for what should be a very basic and common test in Laravel, there seems to be much confusion on how to properly check weather or not a model exists and then do something with the model if it does. When searching through stackoverflow, laracasts, and the laravel documentation itself, it does not become anymore clear. If I for example run this query,</p>
  
  <pre><code>$restaurant = Restaurant::find($input["restaurant_id"]);
  </code></pre>
  
  <p>There are various stack overflow posts that would have me check the count(), use the exists() method which does not seem consistent, or use firstOrFail() which throws an exception. All I want to do is run a call like the one above, check if $restaurant is a valid model, and then do something if it is. There is no need for an exception in my case and I don't want to have to have to run the query again after using something like count() or exists(). The documentation has no useful information on this either which allows 4 different variable types to be returned without any mention of which case will trigger which return. Does anyone have a good handle on this topic?</p>
  
  <p><a href="https://stackoverflow.com/questions/27095090/laravel-checking-if-record-exists">Laravel checking if record exists</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24531312/eloquent-first-if-exists">Eloquent -&gt;first() if -&gt;exists()</a></p>
  
  <p><a href="https://laravel.com/api/5.2/Illuminate/Database/Eloquent/Builder.html#method_find" rel="nofollow noreferrer">https://laravel.com/api/5.2/Illuminate/Database/Eloquent/Builder.html#method_find</a></p>