48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
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()
|
|
{
|
|
//! Important pourra etre retiré quand la V1 sera supprimé
|
|
// empeche l'encapsulation dans data
|
|
JsonResource::withoutWrapping();
|
|
if (!in_array(config('app.env'), ['local', 'testing'])) {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
Paginator::useBootstrap();
|
|
|
|
$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);
|
|
}
|
|
}
|