56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\MacroSchedule\Marker;
|
|
use Illuminate\Pagination\Paginator;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\File;
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
Paginator::useBootstrap();
|
|
if (config('app.env') !== 'local') {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
if (config('app.env') === 'local') {
|
|
setlocale(LC_TIME, strtoupper(config('app.locale')) . "_" . config('app.locale') . '.utf8');
|
|
}
|
|
|
|
|
|
|
|
if (!app()->runningInConsole()) {
|
|
$appInfos = Cache::remember('composer', 360, 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);
|
|
|
|
// * Groups
|
|
View::share('markerLabels', Cache::rememberForever('markerLabels', function () {
|
|
return Marker::getCachedLabels() ?? [];
|
|
}));
|
|
}//end if
|
|
}
|
|
}
|