title: how to get most popular articles from model and order desc
body: <p>I am having a little problem in my laravel 5.2 project. </p>
  
  <p>i want to get popular articles, most visited ones and order by DESC.
  this is my controller code.</p>
  
  <pre><code>public function trending(){
      $trends = DB::table('articles')-&gt;orderBy('hits', 'DESC')-&gt;get();
      return view('frontend.index', compact('trends'))
  </code></pre>
  
  <p>this is not displaying any value.. and my laravel says undefined variable $trends.</p>
  
  <pre><code>@foreach($trends as $trend)
  &lt;li&gt;
  
         &lt;a href="#"&gt;&lt;img class="photo" src="uploads/thumbs/{{ $trend-&gt;image }}" width="90px" height="90px"/&gt;&lt;/a&gt;
  
                  &lt;h2&gt;&lt;a href="{{ route('single.show',$article-&gt;slug) }}"&gt;{{ $trend-&gt;title }}&lt;/a&gt;&lt;/h2&gt;
  
                  &lt;div class="date"&gt;{{date('M j, Y h:ia', strtotime($trend-&gt;created_at))}}&lt;/div&gt;
              &lt;/li&gt;
  @endforeach
  </code></pre>
  
  <p>{{ trends}} variable is not holding any value..</p>