27 lines
673 B
PHP
27 lines
673 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Providers;
|
||
|
|
|
||
|
|
use Carbon\Carbon;
|
||
|
|
use Illuminate\Support\Facades\View;
|
||
|
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
|
||
|
|
class ViewServiceProvider extends ServiceProvider
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Bootstrap any application services.
|
||
|
|
*
|
||
|
|
* @return void
|
||
|
|
*/
|
||
|
|
public function boot(): void
|
||
|
|
{
|
||
|
|
if (!app()->runningInConsole()) {
|
||
|
|
View::share('isDisplayedTAModal', (function () {
|
||
|
|
$now = now();
|
||
|
|
return $now->greaterThanOrEqualTo(new Carbon(config('modal.terreActionStartDate'))) &&
|
||
|
|
$now->lessThanOrEqualTo(new Carbon(config('modal.terreActionEndDate')));
|
||
|
|
})());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|