Support the ongoing development of Laravel.io →
Requests Cache Database
Last updated 1 year ago.
0

Declare a global variable before all the controller methods.

MyController extends Controller {

    protected $query = Model::all();
    
    public function your_method()
    {
         // Some action with the query
    }

    public function other_method()
    {
        // Some action with the query
    }
}
0

Ok, so from what I read TempData is used to pass information from the current request to the next http request.

Most likely you will need to look at caching the data, https://laravel.com/docs/5.1/cache

0

This Article will help you
Share values in Laravel

Last updated 7 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.