添加初始化
parent
6787f9b249
commit
b0e7957550
|
|
@ -14,7 +14,7 @@ Route::group([
|
||||||
$router->get('/', 'HomeController@index');
|
$router->get('/', 'HomeController@index');
|
||||||
$router->resource('auth/users', 'AdministratorController')->names('administrators');
|
$router->resource('auth/users', 'AdministratorController')->names('administrators');
|
||||||
$router->resource('auth/roles', 'RoleController');
|
$router->resource('auth/roles', 'RoleController');
|
||||||
$router->resource('auth/permissions', 'RoleController');
|
$router->resource('auth/permissions', 'PermissionController');
|
||||||
$router->resource('auth/menus', 'MenuController');
|
$router->resource('auth/menus', 'MenuController');
|
||||||
|
|
||||||
$router->resource('ad-addresses', 'AdAddressController')->only([
|
$router->resource('ad-addresses', 'AdAddressController')->only([
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ return [
|
||||||
// Whether enable permission bind to menu.
|
// Whether enable permission bind to menu.
|
||||||
'permission_bind_menu' => true,
|
'permission_bind_menu' => true,
|
||||||
|
|
||||||
'default_icon' => 'feather icon-circle',
|
'default_icon' => '',
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\Admin\Menu;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class AdminMenuSeeder extends Seeder
|
class AdminMenuSeeder extends Seeder
|
||||||
{
|
{
|
||||||
|
|
@ -14,5 +17,182 @@ class AdminMenuSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
$menus = [
|
||||||
|
[
|
||||||
|
'title' => '主页',
|
||||||
|
'icon' => 'feather icon-bar-chart-2',
|
||||||
|
'uri' => '/',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '会员管理',
|
||||||
|
'icon' => 'fa fa-users',
|
||||||
|
'uri' => '',
|
||||||
|
'children' => [
|
||||||
|
[
|
||||||
|
'title' => '会员列表',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'users',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '会员等级',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'vips',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '商城管理',
|
||||||
|
'icon' => 'fa fa-shopping-bag',
|
||||||
|
'uri' => '',
|
||||||
|
'children'=>[
|
||||||
|
[
|
||||||
|
'title' =>'文章管理',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'articles',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '文章分类',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'article-categories',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '广告管理',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'ads',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '广告位置',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'ad-addresses',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '优惠券管理',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'coupons',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '商品管理',
|
||||||
|
'icon' => 'fa fa-shopping-cart',
|
||||||
|
'uri' => '',
|
||||||
|
'children'=>[
|
||||||
|
[
|
||||||
|
'title' => '主商品',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-spus',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '子商品',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-skus',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' =>'上架审核',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-sku-verifies',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '商品分类',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-categories',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title'=>'属性分组',
|
||||||
|
'icon'=>'',
|
||||||
|
'uri' => 'product-groups',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title'=> '商品标签',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-features',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '购买须知',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-buynotes',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '运费模板管理',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'shipping-templates',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '运营管理',
|
||||||
|
'icon' => 'fa fa-',
|
||||||
|
'uri'=>'',
|
||||||
|
'children'=>[
|
||||||
|
[
|
||||||
|
'title' =>'商品分区',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'product-parts',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' =>'发放优惠券',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' =>'coupon-send-tasks',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' =>'优惠券发放记录',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'coupon-task-logs',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '系统管理',
|
||||||
|
'icon' => 'fa fa-fw',
|
||||||
|
'uri' => '',
|
||||||
|
'children' =>[
|
||||||
|
[
|
||||||
|
'title' => '管理员',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'auth/users',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' => '角色',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' => 'auth/roles',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' =>'权限',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' =>'auth/permissions',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'title' =>'菜单',
|
||||||
|
'icon' => '',
|
||||||
|
'uri' =>'auth/menus',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
|
DB::table('admin_menu')->truncate();
|
||||||
|
try {
|
||||||
|
DB::begintransaction();
|
||||||
|
$this->createMenus($menus);
|
||||||
|
DB::commit();
|
||||||
|
} catch (Throwable $th) {
|
||||||
|
DB::rollBack();
|
||||||
|
report($th);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createMenus(array $menus, $pid = 0)
|
||||||
|
{
|
||||||
|
foreach ($menus as $menu) {
|
||||||
|
$mm = Menu::create([
|
||||||
|
'title' => $menu['title'],
|
||||||
|
'icon' => $menu['icon'],
|
||||||
|
'uri' => $menu['uri'],
|
||||||
|
'parent_id' => $pid,
|
||||||
|
]);
|
||||||
|
if (isset($menu['children'])) {
|
||||||
|
$this->createMenus($menu['children'], $mm->id);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,11 @@ class AdminPermissionSeeder extends Seeder
|
||||||
'name'=>'后台接口',
|
'name'=>'后台接口',
|
||||||
'curd' => false,
|
'curd' => false,
|
||||||
'children' => [
|
'children' => [
|
||||||
'product_categories'=>['name'=>'商品分类'],
|
'api.product_categories'=>['name'=>'商品分类'],
|
||||||
'product_group_details' =>['name'=>'商品分组'],
|
'api.product_group_details' =>['name'=>'商品分组'],
|
||||||
'product_skus'=>['name'=>'子商品列表'],
|
'api.product_skus'=>['name'=>'子商品列表'],
|
||||||
|
'api.coupons'=>['name'=>'优惠券'],
|
||||||
|
'api.coupone_send_tasks'=>['name'=>'优惠券发送任务'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'ad_addresses'=>[
|
'ad_addresses'=>[
|
||||||
|
|
@ -136,7 +138,9 @@ class AdminPermissionSeeder extends Seeder
|
||||||
'name' =>'优惠券管理',
|
'name' =>'优惠券管理',
|
||||||
'curd' => true,
|
'curd' => true,
|
||||||
'children'=>[
|
'children'=>[
|
||||||
'range_list' =>'使用范围',
|
'range_list' =>[
|
||||||
|
'name' =>'使用范围',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'coupon_ranges'=>[
|
'coupon_ranges'=>[
|
||||||
|
|
@ -147,13 +151,26 @@ class AdminPermissionSeeder extends Seeder
|
||||||
'name' =>'运费模板管理',
|
'name' =>'运费模板管理',
|
||||||
'curd' => true,
|
'curd' => true,
|
||||||
'children'=>[
|
'children'=>[
|
||||||
'rule_list' => '运费规则',
|
'rule_list' =>[
|
||||||
|
'name' =>'运费规则',
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'shipping_rules'=>[
|
'shipping_rules'=>[
|
||||||
'name' =>'运费规则管理',
|
'name' =>'运费规则管理',
|
||||||
'curd' => ['create', 'store', 'edit', 'update', 'destroy'],
|
'curd' => ['create', 'store', 'edit', 'update', 'destroy'],
|
||||||
],
|
],
|
||||||
|
'coupon_send_tasks'=>[
|
||||||
|
'name' =>'优惠券发放',
|
||||||
|
'curd' => true,
|
||||||
|
'children'=>[
|
||||||
|
'start' =>['name'=>'开始任务'],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'coupon_task_logs'=>[
|
||||||
|
'name' =>'优惠券发放日志',
|
||||||
|
'curd' => ['index'],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
try {
|
try {
|
||||||
DB::begintransaction();
|
DB::begintransaction();
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
$this->call([
|
$this->call([
|
||||||
ProductPartSeeder::class,
|
ProductPartSeeder::class,
|
||||||
|
AdminPermissionSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue