Support the ongoing development of Laravel.io →
Cache Database Eloquent
Last updated 2 years ago.
0

Either ditch the view composer and move that logic into a controller, or you can do something like this:

View::composer(array('home.layout', 'home.partials.sidebar'), function($view)
{
    return $view->with('pages', Page::remember(1)->get());
});

which will cache the result for a minute.

Last updated 2 years ago.
0

What will it use to cache it? KV storages?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Aristona aristona Joined 9 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.