59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\URL;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\View;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
if (!$this->app->environment("local")) {
|
|
URL::forceScheme("https");
|
|
}
|
|
|
|
setlocale(LC_TIME, config('app.locale') . "_" . strtoupper(config('app.locale')) . '.utf8');
|
|
|
|
$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_spring_nextyear = Carbon::create($today->year+1, 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);
|
|
|
|
//Default
|
|
$saison_css = "winter";
|
|
|
|
if ($today->between($start_winter, $start_spring_nextyear, 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);
|
|
}
|
|
}
|