pianello-api/app/View/Composers/DarkModeComposer.php
Ale Gallo b91cf0cbde Committing laravel + api (part 1)
committing part of the laravel system with templating files and api implementation.
2023-11-10 15:54:41 +01:00

19 lines
371 B
PHP

<?php
namespace App\View\Composers;
use Illuminate\View\View;
class DarkModeComposer
{
/**
* Bind dark mode value to the view.
*/
public function compose(View $view): void
{
$view->with(
'darkMode',
session()->has('dark_mode') ? filter_var(session('dark_mode'), FILTER_VALIDATE_BOOLEAN) : false
);
}
}