52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Enums\ArticleCategory;
|
|
use App\Models\Articles;
|
|
use App\Models\Moments;
|
|
use Illuminate\Support\Facades\Cache;
|
|
use Illuminate\Support\Facades\Log;
|
|
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()
|
|
{
|
|
if (config('app.env') !== 'local') {
|
|
URL::forceScheme('https');
|
|
}
|
|
|
|
if (!app()->runningInConsole()) {
|
|
try {
|
|
View::share('momentFiche', Moments::getCachedStar() ?? false);
|
|
} catch (\Exception $e) {
|
|
Log::critical($e->getMessage());
|
|
View::share('momentFiche', false);
|
|
}
|
|
try {
|
|
View::share('actusGlobal', Articles::getCachedActus() ?? []);
|
|
} catch (\Exception $e) {
|
|
Log::critical($e->getMessage());
|
|
View::share('actusGlobal', []);
|
|
}
|
|
}
|
|
}
|
|
}
|