Created
December 15, 2023 16:04
-
-
Save mikehins/f2ebacbceb098a6e9197df95dad0dbee to your computer and use it in GitHub Desktop.
Add application version to Laravel app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AppServiceProvider | |
public function boot(): void | |
{ | |
//... | |
Blade::directive('rev', function () { | |
$v = config('app.version'); | |
$b = exec('git rev-parse --short HEAD'); | |
return ($v ? 'Version ' . $v : '') . ($b ? '<br>Build ' . $b : ''); | |
}); | |
//... | |
// footer.blade.php | |
<footer>@rev</footer> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment