versionData()['version'] ?? 'undefined'); View::share('appIsGit', $this->versionData()['is_git'] ?? false); } /** * Return version information for the footer. * * @return array */ protected function versionData() { return Cache::remember('git-version', 5, function () { if (file_exists(base_path('.git/HEAD'))) { $head = explode(' ', file_get_contents(base_path('.git/HEAD'))); if (array_key_exists(1, $head)) { $path = base_path('.git/' . trim($head[1])); } } if (isset($path) && file_exists($path)) { return [ 'version' => substr(file_get_contents($path), 0, 8), 'is_git' => true, ]; } return [ 'version' => config('app.version'), 'is_git' => false, ]; }); } }