title: Cache all records from query in laravel 5
body: <p>I'm trying to cache all records of the query for 60 minutes by the following method (Method 1)</p>
  
  <pre class="lang-php prettyprint-override"><code>Route::get('categoryList', function() {
     return app\CategoryDetails::remember(60)-&gt;get();
  });
  </code></pre>
  
  <p>I followed this tutorial <a href="http://code.tutsplus.com/tutorials/25-laravel-tips-and-tricks--pre-92818" rel="noreferrer">link</a> (Tip 5: Cache Database Queries)</p>
  
  <p>But I'm getting this error:</p>
  
  <blockquote>
    <p>Call to undefined method <code>Illuminate\Database\Query\Builder::remember()</code></p>
  </blockquote>
  
  <p>I don't know what I'm missing here.</p>
  
  <p>BTW, I know I can cache entire records by the following method (Method 2):</p>
  
  <pre class="lang-php prettyprint-override"><code>Route::get('categoryList', function() {    
      $category = Cache::remember('category', 10, function() {
          return \App\CategoryDetails::all();
      });
  
      return $category;
  });
  </code></pre>
  
  <p>and this is working perfectly.</p>
  
  <p>I am just curious why the first method is not working for me.</p>