소스 검색

add back the github branch (#812)

Dennis 2 년 전
부모
커밋
59c04edf90
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      app/Providers/AppServiceProvider.php

+ 14 - 0
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]);
     }
 }