1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 07:17:55 +01:00
openstamanager/app/Http/Middleware/HandleInertiaRequests.php
Maicol Battistini 0fd3c9a313
impr: Migliorata i18n
Spostata funzione di traduzione JS all'interno di `utils.js` e poi portata in una variabile globale.

Le traduzioni sono ora salvate nella cache.
2021-11-09 10:14:08 +01:00

40 lines
892 B
PHP

<?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Inertia\Middleware;
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
*/
final public function share(Request $request): array
{
return array_merge(parent::share($request), [
'locale' => fn () => app()->getLocale(),
]);
}
final public function rootView(Request $request): string
{
if (in_array($request->route()?->uri(), ['setup', 'login'], true)) {
return 'external';
}
return $this->rootView;
}
}