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
}
}
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
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community