Skip to content

Commit

Permalink
Merge pull request #10 from Williamug/dev
Browse files Browse the repository at this point in the history
Add a blade directive
  • Loading branch information
Williamug committed Apr 16, 2024
2 parents e114166 + 968fbdb commit 0018dc7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<div>
@app_version()
</div>
```

## Testing

Expand Down
10 changes: 10 additions & 0 deletions src/VersioningServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) => "<?php echo exec('git describe --tags --abbrev=0') ?>");
}
}

0 comments on commit 0018dc7

Please sign in to comment.