cacheKey, 3600, function () { if (App::environment('local')) { Session::flash('success', 'Audition Cache Updated'); } return Audition::with(['scoringGuide.subscores', 'judges']) ->withCount('judges') ->withCount('entries') ->orderBy('score_order') ->get() ->keyBy('id'); }); } public function getAudition($id): Audition { return $this->getAuditions()->firstWhere('id', $id); } public function refreshCache() { Cache::forget($this->cacheKey); $this->getAuditions(); } public function clearCache() { if (App::environment('local')) { Session::flash('success', 'Audition Cache Cleared'); } Cache::forget($this->cacheKey); } }