public function show($id) { $cacheTag = ['processes']; $cacheKey = $id; $response = Cache::tags($cacheTag)->remember($cacheKey, 60 * 24 * 7, function () use($id) { $_model = Processes::select(['company_id', 'description', 'order', 'color', 'lastprocess', 'stopprocess', 'created_at', 'updated_at'])->where('company_id', config('global.companies.current.id'))->where('id', $id); if ($_model->count() > 0) { return $_model->first()->toArray(); } else { return false; } }); if (!$response) { Cache::tags($cacheTag)->forget($cacheKey); return new \Exception("Houve um erro ao localizar registro (id not found)"); } return $response; }