ldc-jeusselin/app/Providers/AppServiceProvider.php

56 lines
1.5 KiB
PHP
Raw Normal View History

2021-02-11 11:24:44 +01:00
<?php
namespace App\Providers;
2021-02-23 09:40:21 +01:00
use Illuminate\Support\Facades\URL;
2021-02-11 11:24:44 +01:00
use Illuminate\Support\ServiceProvider;
2021-03-23 12:19:28 +01:00
use Illuminate\Support\Facades\View;
use Illuminate\Support\Carbon;
2021-02-11 11:24:44 +01:00
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
2021-03-23 12:19:28 +01:00
if (!$this->app->environment("local")) {
URL::forceScheme("https");
}
2021-03-30 17:49:54 +02:00
setlocale(LC_TIME, config('app.locale') . "_" . strtoupper(config('app.locale')) . '.utf8');
2021-03-23 12:19:28 +01:00
$today = Carbon::now(); // Current time
$start_winter = Carbon::create($today->year, 12, 21, 0, 0, 0);
$start_spring = Carbon::create($today->year, 3, 20, 0, 0, 0);
$start_summer = Carbon::create($today->year, 6, 21, 0, 0, 0);
$start_fall = Carbon::create($today->year, 9, 22, 0, 0, 0);
if ($today->between($start_winter, $start_spring, true)) {
$saison_css = "winter";
}
if ($today->between($start_spring, $start_summer, true)) {
$saison_css = "spring";
}
if ($today->between($start_summer, $start_fall, true)) {
$saison_css = "summer";
}
if ($today->between($start_fall, $start_winter, true)) {
$saison_css = "fall";
}
View::share('saison_css', $saison_css);
2021-02-11 11:24:44 +01:00
}
}