mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-24 23:37:51 +01:00
40 lines
907 B
PHP
40 lines
907 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', 'setup/admin'], true)) {
|
|
return 'external';
|
|
}
|
|
|
|
return $this->rootView;
|
|
}
|
|
}
|