title: Call to undefined method whereHas() in laravel 5.5
body: <p>I am upgrading and refactoring my site to laravel 5.5, and this code is giving me a problem at the moment. I searched in the laravel github docs and didn't find any breaking changes that might affect this.</p>
  
  <p>What I am trying to do is <strong>Related To</strong> section in my site, In every recipe page I want to display some more recipes that has the same category.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    public static function getRelatedRecipes($recipe){
  
        $related_category_ids  = $recipe-&gt;category()-&gt;pluck('categories.id');
  
          return $relatedRecipes =
          Recipe::whereHas('categories', function ($q)use($related_category_ids){
          $q-&gt;whereIn('category_id', $related_category_ids);
          })
          -&gt;where('id', '&lt;&gt;', $recipe-&gt;id)
          -&gt;take(4)
          -&gt;inRandomOrder()
          -&gt;get();
  }
  </code></pre>
  
  <p>This is the recipe model:</p>
  
  <pre><code>    &lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Recipe extends Model
  {
      protected $guarded=[];
  
      /**
       * Get the route key name for Laravel.
       *
       * @return string
       */
      public function getRouteKeyName()
      {
          return 'slug';
      }
  
  
  
      public function category()
      {
          return $this-&gt;belongsToMany('App\Category');
      }
  
  }
  </code></pre>
  
  <p>What could be the problem? </p>
  
  <p>Thanks,</p>
  
  <p><strong>P.S</strong></p>
  
  <p>If any other code that you think is needed to resolve this, please tell me and I will post it here. :)</p>