Browse Source

Merge pull request #560 from 1day2die/development

show branchname in footer
Dennis 2 years ago
parent
commit
daa0b53c37
2 changed files with 24 additions and 3 deletions
  1. 23 2
      app/Providers/AppServiceProvider.php
  2. 1 1
      resources/views/layouts/main.blade.php

+ 23 - 2
app/Providers/AppServiceProvider.php

@@ -107,12 +107,33 @@ class AppServiceProvider extends ServiceProvider
                 Artisan::call('cache:clear');
                 Artisan::call('cache:clear');
             }
             }
 
 
+
+            try {
+                Artisan::call('config:clear');
+                Artisan::call('cache:clear');
+                $stringfromfile = file(base_path().'/.git/HEAD');
+                Log::debug(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::error($e);
+            }
+            config(['BranchName' => $branchname]);
+
+
             // Set Discord-API Config
             // Set Discord-API Config
             config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]);
             config(['services.discord.client_id' => config('SETTINGS::DISCORD:CLIENT_ID')]);
             config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]);
             config(['services.discord.client_secret' => config('SETTINGS::DISCORD:CLIENT_SECRET')]);
         } catch (Exception $e) {
         } catch (Exception $e) {
-            error_log("Settings Error: Could not load settings from database");
-            Log::error("Settings Error: Could not load settings from database");
+            error_log("Settings Error: Could not load settings from database. The Installation probably is not done yet.");
+            error_log($e);
+            Log::error("Settings Error: Could not load settings from database. The Installation probably is not done yet.");
+            Log::error($e);
         }
         }
     }
     }
 }
 }

+ 1 - 1
resources/views/layouts/main.blade.php

@@ -404,7 +404,7 @@
                     href="{{ url('/') }}">{{ env('APP_NAME', 'Laravel') }}</a>.</strong>
                     href="{{ url('/') }}">{{ env('APP_NAME', 'Laravel') }}</a>.</strong>
             All rights
             All rights
             reserved. Powered by <a href="https://controlpanel.gg">ControlPanel</a>. Version
             reserved. Powered by <a href="https://controlpanel.gg">ControlPanel</a>. Version
-            <b>{{ config('app')['version'] }}</b>
+            <b>{{ config('app')['version'] }} - {{config("BranchName")}}</b>
         </footer>
         </footer>
 
 
         <!-- Control Sidebar -->
         <!-- Control Sidebar -->