Store repository's version number in version.txt and subtly show it in layout view
MODIFY
.gitignore
.gitignore
@@ -14,3 +14,4 @@ yarn-error.log
/public/css
/public/mix-manifest.json
/public/js
+version.txt

MODIFY
app/Providers/AppServiceProvider.php
app/Providers/AppServiceProvider.php
@@ -9,9 +9,12 @@ use Auth;
class AppServiceProvider extends ServiceProvider {
public function boot() {
view()->composer('*', function($view) {
+ $versionNumber = file_exists(base_path() . '/version.txt') ? file_get_contents(base_path() . '/version.txt') : '-';
+
$view->with([
'userName' => Auth::check() ? Auth::user()->name : null,
- 'currency' => Auth::check() ? session('space') ? session('space')->currency->symbol : '-' : null
+ 'currency' => Auth::check() ? session('space') ? session('space')->currency->symbol : '-' : null,
+ 'versionNumber' => $versionNumber
]);
});
}

MODIFY
composer.json
composer.json
"php artisan key:generate"
],
"post-install-cmd": [
- "Illuminate\\Foundation\\ComposerScripts::postInstall"
+ "Illuminate\\Foundation\\ComposerScripts::postInstall",
+ "git describe --always --tags > version.txt"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate"

MODIFY
resources/views/layout.blade.php
resources/views/layout.blade.php
@yield('body')
@if (auth()->check())
<div class="text-center mb-3">
- <a class="fs-sm" href="/ideas/create">{{ __('general.know_how_to_make_this_app_better') }}?</a>
+ <a class="fs-sm" href="/ideas/create">{{ __('general.know_how_to_make_this_app_better') }}?</a> &middot; {{ $versionNumber }}
</div>
@endif
</div>

Store repository's version number in version.txt and subtly show it in layout view