From f71b6153e6a86b89a393ef6bfbef4ff93c3421dd Mon Sep 17 00:00:00 2001 From: 1day2die Date: Fri, 5 May 2023 12:00:10 +0200 Subject: [PATCH] add back the github branch --- app/Providers/AppServiceProvider.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index aad430c6..4bd88d89 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -75,5 +75,19 @@ class AppServiceProvider extends ServiceProvider $settings = $this->app->make(MailSettings::class); $settings->setConfig(); + + try { + $stringfromfile = file(base_path() . '/.git/HEAD'); + + $firstLine = $stringfromfile[0]; //get the string from the array + + $explodedstring = explode('/', $firstLine, 3); //seperate out by the "/" in the string + + $branchname = $explodedstring[2]; //get the one that is always the branch name + } catch (Exception $e) { + $branchname = 'unknown'; + Log::notice($e); + } + config(['BRANCHNAME' => $branchname]); } }