mardi 25 juin 2019

Call to undefined method Illuminate\Database\Query\Builder::remember()

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
{
 //
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire