generateCacheKey(); return Cache::remember($cacheKey, 3600, function () use ($columns) { return parent::get($columns); }); } public function first($columns = ['*']) { $cacheKey = $this->generateCacheKey() . '_first'; return Cache::remember($cacheKey, 3600, function () use ($columns) { return parent::first($columns); }); } protected function generateCacheKey() { // Unique key based on SQL + bindings return 'query_' . md5($this->toSql() . implode(',', $this->getBindings())); } public function clearCache() { $cacheKey = $this->generateCacheKey(); Cache::forget($cacheKey); } }