Reputation: 831
I was trying to cache the db query with built in function remember(). But it doesn't seem to be working fine. Here is fine snippets.
$categories = Category::orderBy('rank', 'asc')
->select('id', 'name', 'rank')
->where('parentid', '=', 0)
->where('id', '<>', 4)
->remember(300)
->get();
This is the reference link, which I was following. I am getting the following error messa
Call to undefined method Illuminate\Database\Query\Builder::remember()
Category.php
<?php
namespace App;
use Eloquent;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
//
}
Upvotes: 3
Views: 3074
Reputation: 1547
This functionality was removed in Laravel 5. However, you can still bring it back by following the tutorial behind this link. It's using the dwightwatson/rememberable package.
A better and future proof way of resolving this issue, is using the Cache method. This functionality is available from Laravel 4.2 onwards.
Upvotes: 7