89 lines
2.8 KiB
PHP
89 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\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 = 'admin.app';
|
|
|
|
/**
|
|
* Determines the current asset version.
|
|
*
|
|
* @see https://inertiajs.com/asset-versioning
|
|
*/
|
|
public function version(Request $request): ?string
|
|
{
|
|
return parent::version($request);
|
|
}
|
|
|
|
/**
|
|
* Define the props that are shared by default.
|
|
*
|
|
* @see https://inertiajs.com/shared-data
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function share(Request $request): array
|
|
{
|
|
return array_merge(parent::share($request), [
|
|
'auth' => function () {
|
|
return [
|
|
'user' => [
|
|
'id' => 1,
|
|
'username' => 'admin',
|
|
'nickname' => 'Admin',
|
|
'avatar' => 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
|
|
],
|
|
|
|
'menus' => [
|
|
[
|
|
'id' => 0,
|
|
'title' => '主页',
|
|
'path' => '/admin',
|
|
'icon' => 'custom:home',
|
|
],
|
|
[
|
|
'id' => 1,
|
|
'title' => '系统管理',
|
|
'path' => '',
|
|
'icon' => 'custom:gear',
|
|
'children' => [
|
|
[
|
|
'id' => 2,
|
|
'title' => '账号管理',
|
|
'path' => '/admin/system/users',
|
|
],
|
|
[
|
|
'id' => 3,
|
|
'title' => '角色管理',
|
|
'path' => '/admin/system/roles',
|
|
],
|
|
[
|
|
'id' => 4,
|
|
'title' => '权限管理',
|
|
'path' => '/admin/system/permissions',
|
|
],
|
|
[
|
|
'id' => 5,
|
|
'title' => '菜单管理',
|
|
'path' => '/admin/system/menus',
|
|
],
|
|
],
|
|
],
|
|
],
|
|
];
|
|
},
|
|
]);
|
|
}
|
|
}
|