zhangchangchun 6 jaren geleden
bovenliggende
commit
69c9989318
3 gewijzigde bestanden met toevoegingen van 50 en 7 verwijderingen
  1. 6 7
      app/Transformers/LoginTransformer.php
  2. 1 0
      bootstrap/app.php
  3. 43 0
      config/menu.php

+ 6 - 7
app/Transformers/LoginTransformer.php

@@ -6,20 +6,19 @@ use App\ShopAccount;
 use App\User;
 use League\Fractal\TransformerAbstract;
 
-class LoginTransformer extends TransformerAbstract
-{
+class LoginTransformer extends TransformerAbstract {
 
-    public function transform(User $user)
-    {
+    public function transform(User $user) {
         return [
-            'id'    => $user['id'],
-            'account'    => !empty($user['account'])?$user['account']:"",
-            'mobile'    => $user['mobile'],
+            'id' => $user['id'],
+            'account' => !empty($user['account']) ? $user['account'] : "",
+            'mobile' => $user['mobile'],
             'status' => $user['status'],
             'shop_id' => $user['shop_id'],
             'token' => "Bearer{$user['token']}",
             'token_ttl' => $user['token_ttl'],
             'shop_account' => $user->shop->toArray(),
+            'menu' => config("menu"),
         ];
     }
 }

+ 1 - 0
bootstrap/app.php

@@ -27,6 +27,7 @@ $app->withEloquent();
 $app->configure('api');
 $app->configure('auth');
 $app->configure('jwt');
+$app->configure('menu');
 
 /*
 |--------------------------------------------------------------------------

+ 43 - 0
config/menu.php

@@ -0,0 +1,43 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Administrator
+ * Date: 2019-05-16
+ * Time: 11:22
+ */
+return [
+    [
+        'name' => 'management',
+        'title' => '商家',
+        'children' => [
+            [
+                'name' => 'product',
+                'title' => '商品',
+                'children' => [
+                    [
+                        'name' => 'product-product',
+                        'title' => '商品管理',
+                    ],
+                    [
+                        'name' => 'product-comment',
+                        'title' => '评价管理',
+                    ],
+                    [
+                        'name' => 'product-trash',
+                        'title' => '回收站',
+                    ],
+                ],
+            ],
+            [
+                'name' => 'order',
+                'title' => '订单',
+                'children' => [
+                    [
+                        'name' => 'order-order',
+                        'title' => '订单管理',
+                    ],
+                ],
+            ],
+        ],
+    ]
+];