38 lines
839 B
PHP
38 lines
839 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Support\BuildMeta;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class BuildMetaServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(BuildMeta::class, fn () => BuildMeta::detect());
|
|
}
|
|
|
|
/**
|
|
* Bootstrap services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
$meta = $this->app->make(BuildMeta::class);
|
|
|
|
// zentral verfügbar
|
|
config([
|
|
'app.version' => $meta->version,
|
|
'app.git_rev' => $meta->rev,
|
|
'app.git_short' => $meta->short,
|
|
'app.build_time' => $meta->updated,
|
|
]);
|
|
|
|
// optional: in allen Views als $build
|
|
View::share('build', $meta);
|
|
}
|
|
}
|