samedi 30 juillet 2016

Laravel Query Builder: Caching a list result

It's possible to cache query result like so:

$users = DB::table('users')->remember(10)->get();

But how do I cache a list result. This doesn't work:

$roles = DB::table('roles')->lists('title'); // Works, but not cached.
$roles = DB::table('roles')->remember(10)->lists('title'); // Not working.

Error thrown:

exception 'BadMethodCallException' with message 'Call to undefined method Illuminate\Database\Query\Builder::remember()'



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire