后台首页头部菜单添加hook, 实现多语言
This commit is contained in:
parent
e9bb58ebd5
commit
6b81f266ee
|
|
@ -28,16 +28,30 @@ class Header extends Component
|
||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$this->addLink('管理首页', 'home.index', equal_route('admin.home.index'));
|
$preparedMenus = $this->prepareMenus();
|
||||||
$this->addLink('订单管理', 'orders.index', equal_route('admin.orders.index'));
|
foreach ($preparedMenus as $menu) {
|
||||||
$this->addLink('商品管理', 'products.index', equal_route('admin.products.index'));
|
$this->addLink($menu['name'], $menu['route'], equal_route("admin.{$menu['name']}"));
|
||||||
$this->addLink('会员管理', 'customers.index', equal_route('admin.customers.index'));
|
}
|
||||||
$this->addLink('系统设置', 'settings.index', equal_route('admin.settings.index'));
|
|
||||||
|
|
||||||
return view('admin::components.header');
|
return view('admin::components.header');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认菜单
|
||||||
|
*/
|
||||||
|
private function prepareMenus()
|
||||||
|
{
|
||||||
|
$menus = [
|
||||||
|
['name' => trans('admin/header.home'), 'route' => 'home.index'],
|
||||||
|
['name' => trans('admin/header.order'), 'route' => 'orders.index'],
|
||||||
|
['name' => trans('admin/header.product'), 'route' => 'products.index'],
|
||||||
|
['name' => trans('admin/header.customer'), 'route' => 'customers.index'],
|
||||||
|
['name' => trans('admin/header.setting'), 'route' => 'settings.index'],
|
||||||
|
];
|
||||||
|
return hook_filter('admin.header_menus', $menus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加后台顶部菜单链接
|
* 添加后台顶部菜单链接
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* header.php
|
||||||
|
*
|
||||||
|
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||||
|
* @link http://www.guangdawangluo.com
|
||||||
|
* @author Edward Yang <yangjin@opencart.cn>
|
||||||
|
* @created 2022-08-02 19:03:19
|
||||||
|
* @modified 2022-08-02 19:03:19
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'home' => 'Home',
|
||||||
|
'order' => 'Orders',
|
||||||
|
'product' => 'Products',
|
||||||
|
'customer' => 'Customers',
|
||||||
|
'setting' => 'Settings',
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* header.php
|
||||||
|
*
|
||||||
|
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||||
|
* @link http://www.guangdawangluo.com
|
||||||
|
* @author Edward Yang <yangjin@opencart.cn>
|
||||||
|
* @created 2022-08-02 19:03:19
|
||||||
|
* @modified 2022-08-02 19:03:19
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
'home' => '管理首页',
|
||||||
|
'order' => '订单管理',
|
||||||
|
'product' => '商品管理',
|
||||||
|
'customer' => '会员管理',
|
||||||
|
'setting' => '系统设置',
|
||||||
|
];
|
||||||
Loading…
Reference in New Issue