ldc-supportweb/app/Providers/ViewServiceProvider.php
2023-08-14 09:23:39 +00:00

37 lines
1.1 KiB
PHP

<?php
namespace App\Providers;
use App\Models\Information;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
class ViewServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if (!app()->runningInConsole()) {
$appInfos = Cache::remember('composer', 3600, function () {
return json_decode(File::get(\app_path('../composer.json')));
});
View::share('name', $appInfos->name);
View::share('version', $appInfos->version);
View::share('license', $appInfos->license);
// * Informations
$infos = Cache::remember('infos', 3600, function () {
return Information::all();
});
View::share('informations', $infos);
// * FORCE BOOTSTRAP PAGINATOR
Paginator::defaultView('bo.modules.pagination');
} //end if
}
}