1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-03-13 01:30:11 +01:00
openstamanager/app/Http/Middleware/HandleInertiaRequests.php
2023-05-07 17:06:01 +02:00

34 lines
822 B
PHP

<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Inertia\Middleware;
use JetBrains\PhpStorm\ArrayShape;
class HandleInertiaRequests extends Middleware
{
/**
* The root template that's loaded on the first page visit.
*
* @see https://inertiajs.com/server-side-setup#root-template
*
* @var string
*/
protected $rootView = 'app';
/**
* Defines the props that are shared by default.
*
* @see https://inertiajs.com/shared-data
*/
#[ArrayShape([0 => 'array|\Closure[]', 'locale' => Closure::class])]
final public function share(Request $request): array
{
return [...parent::share($request), 'locale' => static fn () => app()->getLocale()];
}
}