there are two ways of doing this: (or that I can see)
use caching.. (so when you do a query cache it for 5 or so minutes) - if you want fresh data or data changes significantly each second & taking account of that is required then obviously dont do this
create a variable in that class, set it to null. create a method that checks if that var is null, if so does the query otherwise just returns that variable.. (will re-run the query on each page refresh)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community