title: Count how many reviews a post has - Laravel 5.2
body: <p>I need to count how many reviews a post has. How would I go about doing that?</p>
  
  <p>Here is my Listing.php Model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Listing extends Model
  {
  
      public function reviews()
      {
          return $this-&gt;hasMany('\App\Review');
      }
  
  }
  </code></pre>
  
  <p>Here is my Review.php model:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Review extends Model
  {
      protected $fillable = ['stars','name','comment'];
  
      public function listing()
      {
          return $this-&gt;belongsTo('\App\Listing');
      }
  }
  </code></pre>
  
  <p>Here is my method that I'am trying to count in controller</p>
  
  <pre><code> public function mostReviews(Request $request) {
  
          $listings = Review::orderBy('-- most reviews here --')-&gt;take(10)-&gt;get();
  
          $headline = 'Most Reviewed Listings';
  
          return view('pages.listings', compact('listings', 'headline'));
  
      }
  </code></pre>
  
  <p>Here is my review table:</p>
  
  <p><a href="https://i.stack.imgur.com/zr9wq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zr9wq.png" alt="Review table for listing"></a></p>