From e49459a04a217ca8690d72be24b63bf5be04dac3 Mon Sep 17 00:00:00 2001 From: Asaba William Date: Tue, 16 Apr 2024 13:28:21 +0300 Subject: [PATCH 1/2] Add documentation --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4552b0b..c475396 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,14 @@ If you are using Laravel you can use the following code to display the version o Williamug\Versioning\Versioning::tag() // v1.0.0 ``` -You can add the above piece of code in either your controller or blade views. + +#### For Laravel Blade +If you are using Laravel Blade you can use the following code to display the version of your application: +```blade +
+ @app_version() +
+``` ## Testing From 968fbdb0295b84633cc2c9a18918f64afb5bafc6 Mon Sep 17 00:00:00 2001 From: Asaba William Date: Tue, 16 Apr 2024 13:28:33 +0300 Subject: [PATCH 2/2] Add blade directive --- src/VersioningServiceProvider.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/VersioningServiceProvider.php b/src/VersioningServiceProvider.php index 16774ad..6ec80cc 100644 --- a/src/VersioningServiceProvider.php +++ b/src/VersioningServiceProvider.php @@ -11,4 +11,14 @@ public function configurePackage(Package $package): void { $package->name('versioning'); } + + /** + * Bootstrap services. + * + * @return void + */ + public function boot() + { + Blade::directive('app_version', fn ($money) => ""); + } }