$class) { if (! Cache::has($name) || $force) { if ($name == 'payment_terms') { $orderBy = 'num_days'; } elseif ($name == 'fonts') { $orderBy = 'sort_order'; } elseif (in_array($name, ['currencies', 'industries', 'languages', 'countries', 'banks', 'timezones'])) { $orderBy = 'name'; } else { $orderBy = 'id'; } $tableData = $class::orderBy($orderBy)->get(); if ($tableData->count() > 1) { Cache::forever($name, $tableData); } } } /*Build template cache*/ } private function updateEnvironmentProperty(string $property, $value): void { $env = file(base_path('.env')); $position = null; foreach ((array) $env as $key => $variable) { if (Str::startsWith($variable, $property)) { $position = $key; } } $words_count = count(explode(' ', trim($value))); if (is_null($position)) { $words_count > 1 ? $env[] = "{$property}=".'"'.$value.'"'."\n" : $env[] = "{$property}=".$value."\n"; } else { $env[$position] = "{$property}=".'"'.$value.'"'."\n"; // If value of variable is more than one word, surround with quotes. } try { file_put_contents(base_path('.env'), $env); } catch (\Exception $e) { info($e->getMessage()); } } }