Ver código fonte

多后台功能

whj 4 anos atrás
pai
commit
1e66cffd92

+ 22 - 0
app/Admin/Actions/Commuinity/Nurse/DelNurse.php

xqd
@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Admin\Actions\Commuinity\Nurse;
+
+use App\Models\Order;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class  DelNurse extends RowAction
+{
+    public $name = '删除';
+
+    public function handle(Model $model)
+    {
+        $id = $this->row->id;
+        $order_id = $this->row->order_id;
+        $model->where('id',$id)->delete();
+        Order::where('id',$order_id)->delete();
+        return $this->response()->success('Success message.')->refresh();
+    }
+
+}

+ 24 - 0
app/Admin/Actions/Commuinity/Nurse/Finished.php

xqd
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Admin\Actions\Commuinity\Nurse;
+
+use App\Models\Order;
+use Encore\Admin\Actions\RowAction;
+use Illuminate\Database\Eloquent\Model;
+
+class Finished extends RowAction
+{
+    public $name = '完成';
+
+    public function handle(Model $model)
+    {
+        $id = $this->row->order_id;
+        $res = Order::where('id',$id)->update(['order_status'=>Order::FINISHED]);
+        if($res){
+            return $this->response()->success('操作成功!')->refresh();
+        }
+
+        return $this->response()->error('操作失败!');
+    }
+
+}

+ 25 - 0
app/Admin/Actions/Community.php

xqd
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Admin\Actions;
+
+use Encore\Admin\Actions\Action;
+use Illuminate\Http\Request;
+
+class Community extends Action
+{
+    protected $selector = '.community';
+
+    public function handle(Request $request)
+    {
+        // $request ...
+
+        return $this->response()->success('Success message...')->refresh();
+    }
+
+    public function html()
+    {
+        return <<<HTML
+        <a class="btn btn-sm btn-default community"></a>
+HTML;
+    }
+}

+ 25 - 0
app/Admin/Actions/finished.php

xqd
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Admin\Actions;
+
+use Encore\Admin\Actions\Action;
+use Illuminate\Http\Request;
+
+class finished extends Action
+{
+    protected $selector = '.finished';
+
+    public function handle(Request $request)
+    {
+        // $request ...
+
+        return $this->response()->success('Success message...')->refresh();
+    }
+
+    public function html()
+    {
+        return <<<HTML
+        <a class="btn btn-sm btn-default finished"></a>
+HTML;
+    }
+}

+ 1 - 1
app/Admin/Controllers/AuthController.php

xqd
@@ -2,7 +2,7 @@
 
 namespace App\Admin\Controllers;
 
-use Encore\Admin\Http\Controllers\AuthController as BaseAuthController;
+use Encore\Admin\Controllers\AuthController as BaseAuthController;
 
 class AuthController extends BaseAuthController
 {

+ 10 - 10
app/Admin/Controllers/ExampleController.php

xqd xqd
@@ -2,9 +2,9 @@
 
 namespace App\Admin\Controllers;
 
-use Encore\Admin\Http\Controllers\AdminController;
+use Encore\Admin\Controllers\AdminController;
 use Encore\Admin\Form;
-use Encore\Admin\Table;
+use Encore\Admin\Grid;
 use Encore\Admin\Show;
 
 class ExampleController extends AdminController
@@ -17,19 +17,19 @@ class ExampleController extends AdminController
     protected $title = 'Example controller';
 
     /**
-     * Make a table builder.
+     * Make a grid builder.
      *
-     * @return Table
+     * @return Grid
      */
-    protected function table()
+    protected function grid()
     {
-        $table = new Table(new ExampleModel);
+        $grid = new Grid(new ExampleModel);
 
-        $table->column('id', __('ID'))->sortable();
-        $table->column('created_at', __('Created at'));
-        $table->column('updated_at', __('Updated at'));
+        $grid->column('id', __('ID'))->sortable();
+        $grid->column('created_at', __('Created at'));
+        $grid->column('updated_at', __('Updated at'));
 
-        return $table;
+        return $grid;
     }
 
     /**

+ 1 - 0
app/Admin/bootstrap.php

xqd
@@ -18,3 +18,4 @@
  *
  */
 
+Encore\Admin\Form::forget(['map', 'editor']);

+ 51 - 0
app/Community/bootstrap.php

xqd
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Laravel-admin - admin builder based on Laravel.
+ * @author z-song <https://github.com/z-song>
+ *
+ * Bootstraper for Admin.
+ *
+ * Here you can remove builtin form field:
+ * Encore\Admin\Form::forget(['map', 'editor']);
+ *
+ * Or extend custom form field:
+ * Encore\Admin\Form::extend('php', PHPEditor::class);
+ *
+ * Or require js and css assets:
+ * Admin::css('/packages/prettydocs/css/styles.css');
+ * Admin::js('/packages/prettydocs/js/main.js');
+ *
+ */
+
+use Encore\Admin\Form;
+use Encore\Admin\Grid;
+Form::extend('week', \App\Admin\Extensions\Week::class);
+Grid::init(function (Grid $grid) {
+
+//    $grid->disableActions();
+//    $grid->disablePagination();
+//    $grid->disableFilter();
+//    $grid->disableRowSelector();
+//    $grid->disableColumnSelector();
+//    $grid->disableTools();
+    $grid->disableExport();
+
+    $grid->disableCreateButton();
+    $grid->actions(function (Grid\Displayers\Actions $actions) {
+        $actions->disableView();
+//        $actions->disableEdit(s);
+        $actions->disableDelete();
+    });
+});
+//Encore\Admin\Form::forget(['map', 'editor']);
+Form::init(function (Form $form){
+    $form->disableEditingCheck();
+    $form->disableCreatingCheck();
+    $form->disableViewCheck();
+
+    $form->tools(function (Form\Tools $tools) {
+        $tools->disableDelete();
+
+    });
+});

+ 11 - 0
app/Community/routes.php

xqd
@@ -0,0 +1,11 @@
+<?php
+
+Route::get('/', 'HomeController@index');
+Route::get('/api/getDocter', 'Apicontroller@getDocter');
+Route::resource('nurses', NurseController::class);
+Route::resource('order_nurses', OrderNurseController::class);
+Route::resource('vaccines', VaccineController::class);
+Route::resource('order_vaccines', OrderVaccinesController::class);
+Route::resource('docters', DocterController::class);
+Route::resource('offices', OfficeController::class);
+

+ 1 - 1
app/Http/Middleware/VerifyCsrfToken.php

xqd
@@ -19,6 +19,6 @@ class VerifyCsrfToken extends Middleware
      * @var array
      */
     protected $except = [
-        //
+        '*'
     ];
 }

+ 6 - 1
app/Models/Nurse.php

xqd
@@ -10,5 +10,10 @@ namespace App\Models;
 
 class Nurse extends BaseModel
 {
-
+    protected $appends = ['today'];
+    public function getTodayAttribute()
+    {
+        $id = $this->attributes['id'];
+        return OrderNurse::where(['nurse_id'=>$id,'created_at'=>['>',date('Y-m-d 00:00:00',time())]])->count();
+    }
 }

+ 14 - 0
app/Models/Order.php

xqd
@@ -10,6 +10,20 @@ namespace App\Models;
 
 class Order extends BaseModel
 {
+    CONST UNPAID = 1, ISING = 2, FINISHED = 3,CANCELED=4; //订单状态(1.未支付 2.进行中 3.已完成 4.已取消)
+    public static  $_order_status = [
+        self::UNPAID=>'未支付',
+        self::ISING=>'进行中',
+        self::FINISHED=>'已完成',
+        self::CANCELED=>'已取消',
+    ];
+
+    //获取订单状态
+    public function getStatus()
+    {
+        return self::$_order_status;
+    }
+
     public function docter()
     {
         return $this->belongsTo(Docter::class);

+ 10 - 0
app/Models/OrderNurse.php

xqd
@@ -11,4 +11,14 @@ namespace App\Models;
 class OrderNurse extends BaseModel
 {
 
+    public function orders()
+    {
+        return $this->hasOne(Order::class,'id','order_id');
+    }
+
+    public function patients()
+    {
+        return $this->hasOne(OrderPatient::class,'id','order_patient_id');
+    }
+
 }

+ 14 - 0
app/Models/OrderVaccine.php

xqd
@@ -11,4 +11,18 @@ namespace App\Models;
 class OrderVaccine extends BaseModel
 {
 
+    public  function patients()
+    {
+        return $this->hasOne(OrderPatient::class , 'id','order_patient_id');
+    }
+
+    public function docters()
+    {
+        return $this->hasOne(Docter::class,'id','docter_id');
+    }
+
+    public function orders()
+    {
+        return $this->hasOne(Order::class,'id','order_id');
+    }
 }

+ 2 - 1
app/Providers/AppServiceProvider.php

xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Providers;
 
+use Illuminate\Support\Facades\Schema;
 use Illuminate\Support\ServiceProvider;
 
 class AppServiceProvider extends ServiceProvider
@@ -23,6 +24,6 @@ class AppServiceProvider extends ServiceProvider
      */
     public function boot()
     {
-        //
+        Schema::defaultStringLength(191);
     }
 }

+ 12 - 2
composer.json

xqd xqd
@@ -9,8 +9,9 @@
     "license": "MIT",
     "require": {
         "php": "^7.2",
-        "encore/laravel-admin": "^2.0",
+        "encore/laravel-admin": "1.*",
         "fideloper/proxy": "^4.0",
+        "laravel-admin-ext/multitenancy": "^2.1",
         "laravel/framework": "^6.0",
         "laravel/tinker": "^1.0",
         "overtrue/wechat": "^4.0"
@@ -62,5 +63,14 @@
         "post-create-project-cmd": [
             "@php artisan key:generate --ansi"
         ]
-    }
+    },
+    "repositories": [
+        {
+            "type": "path",
+            "url": "storage/multitenancy",
+            "options": {
+                "symlink": false
+            }
+        }
+    ]
 }

+ 92 - 46
composer.lock

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "5c15593d000c96a97bfb0fb53c9f7019",
+    "content-hash": "6f09d3514cf131189db240b04e0ab14b",
     "packages": [
         {
             "name": "dnoegel/php-xdg-base-dir",
@@ -135,16 +135,16 @@
         },
         {
             "name": "doctrine/dbal",
-            "version": "2.10.4",
+            "version": "2.12.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/doctrine/dbal.git",
-                "reference": "47433196b6390d14409a33885ee42b6208160643"
+                "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/47433196b6390d14409a33885ee42b6208160643",
-                "reference": "47433196b6390d14409a33885ee42b6208160643",
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/c6d37b4c42aaa3c3ee175f05eca68056f4185646",
+                "reference": "c6d37b4c42aaa3c3ee175f05eca68056f4185646",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -157,17 +157,16 @@
                 "doctrine/cache": "^1.0",
                 "doctrine/event-manager": "^1.0",
                 "ext-pdo": "*",
-                "php": "^7.2"
+                "php": "^7.3 || ^8"
             },
             "require-dev": {
                 "doctrine/coding-standard": "^8.1",
                 "jetbrains/phpstorm-stubs": "^2019.1",
-                "nikic/php-parser": "^4.4",
                 "phpstan/phpstan": "^0.12.40",
-                "phpunit/phpunit": "^8.5.5",
+                "phpunit/phpunit": "^9.4",
                 "psalm/plugin-phpunit": "^0.10.0",
                 "symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
-                "vimeo/psalm": "^3.14.2"
+                "vimeo/psalm": "^3.17.2"
             },
             "suggest": {
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
@@ -178,8 +177,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.10.x-dev",
-                    "dev-develop": "3.0.x-dev"
+                    "dev-master": "4.0.x-dev"
                 }
             },
             "autoload": {
@@ -232,7 +230,7 @@
                 "sqlserver",
                 "sqlsrv"
             ],
-            "time": "2020-09-12T21:20:41+00:00"
+            "time": "2020-10-22T17:26:24+00:00"
         },
         {
             "name": "doctrine/event-manager",
@@ -643,16 +641,16 @@
         },
         {
             "name": "encore/laravel-admin",
-            "version": "v2.0.0-beta2",
+            "version": "v1.8.6",
             "source": {
                 "type": "git",
                 "url": "https://github.com/z-song/laravel-admin.git",
-                "reference": "f6f84b9e060c27d0771ff396fcab557adab88b84"
+                "reference": "e3060ea62e6f625d0daf92ae5ef721469851c587"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/z-song/laravel-admin/zipball/f6f84b9e060c27d0771ff396fcab557adab88b84",
-                "reference": "f6f84b9e060c27d0771ff396fcab557adab88b84",
+                "url": "https://api.github.com/repos/z-song/laravel-admin/zipball/e3060ea62e6f625d0daf92ae5ef721469851c587",
+                "reference": "e3060ea62e6f625d0daf92ae5ef721469851c587",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -671,7 +669,8 @@
                 "fzaninotto/faker": "~1.4",
                 "intervention/image": "~2.3",
                 "laravel/browser-kit-testing": "^6.0",
-                "laravel/laravel": ">=5.5"
+                "laravel/laravel": ">=5.5",
+                "spatie/phpunit-watcher": "^1.22.0"
             },
             "suggest": {
                 "intervention/image": "Required to handling and manipulation upload images (~2.3).",
@@ -711,10 +710,10 @@
             "keywords": [
                 "admin",
                 "form",
-                "laravel",
-                "table"
+                "grid",
+                "laravel"
             ],
-            "time": "2020-09-19T06:43:37+00:00"
+            "time": "2020-09-27T03:07:05+00:00"
         },
         {
             "name": "fideloper/proxy",
@@ -1098,6 +1097,53 @@
             "abandoned": "php-parallel-lint/php-console-highlighter",
             "time": "2018-09-29T18:48:56+00:00"
         },
+        {
+            "name": "laravel-admin-ext/multitenancy",
+            "version": "v2.1.7",
+            "dist": {
+                "type": "path",
+                "url": "storage/multitenancy",
+                "reference": "763ea0bd595ee3de795e21df8b5914c56b37a9b7"
+            },
+            "require": {
+                "encore/laravel-admin": "*",
+                "php": ">=7.0.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~6.0"
+            },
+            "type": "library",
+            "extra": {
+                "laravel": {
+                    "providers": [
+                        "Encore\\Admin\\Multitenancy\\MultitenancyServiceProvider"
+                    ]
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Encore\\Admin\\Multitenancy\\": "src/"
+                }
+            },
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "song",
+                    "email": "zosong@126.com"
+                }
+            ],
+            "description": "Install a new laravel-admin tenancy",
+            "homepage": "https://github.com/laravel-admin-ext/multitenancy",
+            "keywords": [
+                "extension",
+                "laravel-admin"
+            ],
+            "transport-options": {
+                "symlink": false
+            }
+        },
         {
             "name": "laravel/framework",
             "version": "v6.18.40",
@@ -3106,16 +3152,16 @@
         },
         {
             "name": "symfony/dom-crawler",
-            "version": "v5.1.5",
+            "version": "v5.1.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/dom-crawler.git",
-                "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315"
+                "reference": "6d6885e167aad0af4128b392f22d8f2a33dd88ec"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/3ac31ffbc596e41ca081037b7d78fc7a853c0315",
-                "reference": "3ac31ffbc596e41ca081037b7d78fc7a853c0315",
+                "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6d6885e167aad0af4128b392f22d8f2a33dd88ec",
+                "reference": "6d6885e167aad0af4128b392f22d8f2a33dd88ec",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -3170,7 +3216,7 @@
             ],
             "description": "Symfony DomCrawler Component",
             "homepage": "https://symfony.com",
-            "time": "2020-08-12T08:45:47+00:00"
+            "time": "2020-09-02T16:23:27+00:00"
         },
         {
             "name": "symfony/error-handler",
@@ -3663,16 +3709,16 @@
         },
         {
             "name": "symfony/polyfill-ctype",
-            "version": "v1.18.1",
+            "version": "v1.20.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-ctype.git",
-                "reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
+                "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
-                "reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
+                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f4ba089a5b6366e453971d3aad5fe8e897b37f41",
+                "reference": "f4ba089a5b6366e453971d3aad5fe8e897b37f41",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -3682,7 +3728,7 @@
                 ]
             },
             "require": {
-                "php": ">=5.3.3"
+                "php": ">=7.1"
             },
             "suggest": {
                 "ext-ctype": "For best performance"
@@ -3690,7 +3736,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.18-dev"
+                    "dev-main": "1.20-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -3727,7 +3773,7 @@
                 "polyfill",
                 "portable"
             ],
-            "time": "2020-07-14T12:35:20+00:00"
+            "time": "2020-10-23T14:02:19+00:00"
         },
         {
             "name": "symfony/polyfill-iconv",
@@ -3950,16 +3996,16 @@
         },
         {
             "name": "symfony/polyfill-mbstring",
-            "version": "v1.18.1",
+            "version": "v1.20.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-mbstring.git",
-                "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
+                "reference": "39d483bdf39be819deabf04ec872eb0b2410b531"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
-                "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/39d483bdf39be819deabf04ec872eb0b2410b531",
+                "reference": "39d483bdf39be819deabf04ec872eb0b2410b531",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -3969,7 +4015,7 @@
                 ]
             },
             "require": {
-                "php": ">=5.3.3"
+                "php": ">=7.1"
             },
             "suggest": {
                 "ext-mbstring": "For best performance"
@@ -3977,7 +4023,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.18-dev"
+                    "dev-main": "1.20-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4015,7 +4061,7 @@
                 "portable",
                 "shim"
             ],
-            "time": "2020-07-14T12:35:20+00:00"
+            "time": "2020-10-23T14:02:19+00:00"
         },
         {
             "name": "symfony/polyfill-php70",
@@ -4221,16 +4267,16 @@
         },
         {
             "name": "symfony/polyfill-php80",
-            "version": "v1.18.1",
+            "version": "v1.20.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php80.git",
-                "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981"
+                "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/d87d5766cbf48d72388a9f6b85f280c8ad51f981",
-                "reference": "d87d5766cbf48d72388a9f6b85f280c8ad51f981",
+                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
+                "reference": "e70aa8b064c5b72d3df2abd5ab1e90464ad009de",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -4240,12 +4286,12 @@
                 ]
             },
             "require": {
-                "php": ">=7.0.8"
+                "php": ">=7.1"
             },
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "1.18-dev"
+                    "dev-main": "1.20-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4289,7 +4335,7 @@
                 "portable",
                 "shim"
             ],
-            "time": "2020-07-14T12:35:20+00:00"
+            "time": "2020-10-23T14:02:19+00:00"
         },
         {
             "name": "symfony/process",

+ 166 - 101
config/admin.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -4,27 +4,37 @@ return [
 
     /*
     |--------------------------------------------------------------------------
-    | The name of admin application
+    | Laravel-admin name
     |--------------------------------------------------------------------------
     |
-    | This value is the name of admin application, This setting is displayed on the
+    | This value is the name of laravel-admin, This setting is displayed on the
     | login page.
     |
     */
-    'name' => 'Laravel-admin',
+    'name' => '超级妈力管理平台',
 
     /*
     |--------------------------------------------------------------------------
-    | Logo setting of admin application
+    | Laravel-admin logo
     |--------------------------------------------------------------------------
     |
+    | The logo of all admin pages. You can also set it as an image by using a
+    | `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
+    |
     */
-    'logo' => [
-
-        'image' => '/vendor/laravel-admin/AdminLTE/img/AdminLTELogo.png',
+    'logo' => '<b>超级妈力</b> 管理平台',
 
-        'text' => '<span class="font-weight-bolder">Laravel-admin</span>',
-    ],
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin mini logo
+    |--------------------------------------------------------------------------
+    |
+    | The logo of all admin pages when the sidebar menu is collapsed. You can
+    | also set it as an image by using a `img` tag, eg
+    | '<img src="http://logo-url" alt="Admin logo">'.
+    |
+    */
+    'logo-mini' => '<b>超级妈力</b>',
 
     /*
     |--------------------------------------------------------------------------
@@ -52,7 +62,7 @@ return [
 
         'namespace' => 'App\\Admin\\Controllers',
 
-        'middleware' => ['web', 'admin'],
+        'middleware' => ['web', 'admin','multi-session:path,/admin'],
     ],
 
     /*
@@ -75,7 +85,7 @@ return [
     | Html title for all pages.
     |
     */
-    'title' => 'Admin',
+    'title' => '超级妈力',
 
     /*
     |--------------------------------------------------------------------------
@@ -114,7 +124,7 @@ return [
         'providers' => [
             'admin' => [
                 'driver' => 'eloquent',
-                'model'  => Encore\Admin\Models\Administrator::class,
+                'model'  => Encore\Admin\Auth\Database\Administrator::class,
             ],
         ],
 
@@ -128,10 +138,7 @@ return [
         'excepts' => [
             'auth/login',
             'auth/logout',
-            '_handle_form_',
             '_handle_action_',
-            '_handle_selectable_',
-            '_handle_renderable_',
         ],
     ],
 
@@ -171,13 +178,70 @@ return [
 
         // User tables and model.
         'users_table' => 'admin_users',
-        'users_model' => Encore\Admin\Models\Administrator::class,
+        'users_model' => Encore\Admin\Auth\Database\Administrator::class,
+
+        // Role table and model.
+        'roles_table' => 'admin_roles',
+        'roles_model' => Encore\Admin\Auth\Database\Role::class,
+
+        // Permission table and model.
+        'permissions_table' => 'admin_permissions',
+        'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
 
         // Menu table and model.
         'menu_table' => 'admin_menu',
-        'menu_model' => Encore\Admin\Models\Menu::class,
+        'menu_model' => Encore\Admin\Auth\Database\Menu::class,
+
+        // Pivot table for table above.
+        'operation_log_table'    => 'admin_operation_log',
+        'user_permissions_table' => 'admin_user_permissions',
+        'role_users_table'       => 'admin_role_users',
+        'role_permissions_table' => 'admin_role_permissions',
+        'role_menu_table'        => 'admin_role_menu',
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | User operation log setting
+    |--------------------------------------------------------------------------
+    |
+    | By setting this option to open or close operation log in laravel-admin.
+    |
+    */
+    'operation_log' => [
+
+        'enable' => true,
+
+        /*
+         * Only logging allowed methods in the list
+         */
+        'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
+
+        /*
+         * Routes that will not log to database.
+         *
+         * All method to path like: admin/auth/logs
+         * or specific method to path like: get:admin/auth/logs.
+         */
+        'except' => [
+            'admin/auth/logs*',
+        ],
     ],
 
+    /*
+    |--------------------------------------------------------------------------
+    | Indicates whether to check route permission.
+    |--------------------------------------------------------------------------
+    */
+    'check_route_permission' => true,
+
+    /*
+    |--------------------------------------------------------------------------
+    | Indicates whether to check menu roles.
+    |--------------------------------------------------------------------------
+    */
+    'check_menu_roles'       => true,
+
     /*
     |--------------------------------------------------------------------------
     | User default avatar
@@ -186,96 +250,47 @@ return [
     | Set a default avatar for newly created users.
     |
     */
-    'default_avatar' => '/vendor/laravel-admin/AdminLTE/img/user2-160x160.jpg',
+    'default_avatar' => '/vendor/laravel-admin/AdminLTE/dist/img/user2-160x160.jpg',
 
     /*
     |--------------------------------------------------------------------------
-    | Application theme
+    | Admin map field provider
     |--------------------------------------------------------------------------
     |
-    | @see https://adminlte.io/docs/3.0/layout.html
+    | Supported: "tencent", "google", "yandex".
     |
     */
-    'theme' => [
+    'map_provider' => 'google',
 
-        /*
-        |--------------------------------------------------------------------------
-        | Available layout options.
-        |--------------------------------------------------------------------------
-        | Fixed Sidebar: use the class `.layout-fixed` to get a fixed sidebar.
-        | Fixed Navbar: use the class `.layout-navbar-fixed` to get a fixed navbar.
-        | Fixed Footer: use the class `.layout-footer-fixed` to get a fixed footer.
-        | Collapsed Sidebar: use the class `.sidebar-collapse` to have a collapsed sidebar upon loading.
-        | Boxed Layout: use the class `.layout-boxed` to get a boxed layout that stretches only to 1250px.
-        | Top Navigation: use the class `.layout-top-nav` to remove the sidebar and have your links at the top navbar.
-        |
-        */
-        'layout' => ['sidebar-mini', 'sidebar-collapse', 'text-sm'],
-
-        /*
-        |--------------------------------------------------------------------------
-        | Default color for all links.
-        |--------------------------------------------------------------------------
-        |
-        | navbar-light or navbar-dark for content color
-        |
-        | navbar-$color for backgroud color
-        |
-        | Available $color options:
-        |    primary secondary secondary info warning danger black gray-dark  gray
-        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
-        |
-        */
-        'navbar' => 'navbar-light navbar-white',
-
-        /*
-        |--------------------------------------------------------------------------
-        | Default color for all links.
-        |--------------------------------------------------------------------------
-        |
-        | Available options:
-        |    primary secondary secondary info warning danger black gray-dark  gray
-        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
-        |
-        */
-        'accent' => 'info',
-
-        /*
-        |--------------------------------------------------------------------------
-        | Default color for card form and buttons.
-        |--------------------------------------------------------------------------
-        |
-        | light-$color or dark-$color
-        |
-        | Available $color options:
-        |    primary secondary secondary info warning danger black gray-dark  gray
-        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
-        |
-        */
-        'sidebar' => 'light-info',
-
-        /*
-        |--------------------------------------------------------------------------
-        | Default color for card, form and buttons.
-        |--------------------------------------------------------------------------
-        |
-        | Available options:
-        |    primary secondary secondary info warning danger
-        */
-        'color' => 'info',
+    /*
+    |--------------------------------------------------------------------------
+    | Application Skin
+    |--------------------------------------------------------------------------
+    |
+    | This value is the skin of admin pages.
+    | @see https://adminlte.io/docs/2.4/layout
+    |
+    | Supported:
+    |    "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
+    |    "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
+    |    "skin-red", "skin-red-light", "skin-black", "skin-black-light".
+    |
+    */
+    'skin' => 'skin-blue-light',
 
-        /*
-        |--------------------------------------------------------------------------
-        | Logo backgroud color.
-        |--------------------------------------------------------------------------
-        |
-        | Available color options:
-        |    primary secondary secondary info warning danger black gray-dark  gray
-        |    light indigo  navy purple fuchsia pink maroon orange lime teal olive
-        |
-        */
-        'logo' => 'light',
-    ],
+    /*
+    |--------------------------------------------------------------------------
+    | Application layout
+    |--------------------------------------------------------------------------
+    |
+    | This value is the layout of admin pages.
+    | @see https://adminlte.io/docs/2.4/layout
+    |
+    | Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
+    | "sidebar-mini".
+    |
+    */
+    'layout' => ['sidebar-mini'],
 
     /*
     |--------------------------------------------------------------------------
@@ -285,7 +300,7 @@ return [
     | This value is used to set the background image of login page.
     |
     */
-    'login_background_image' => '',
+    'login_background_image' => '/img/bg.jpg',
 
     /*
     |--------------------------------------------------------------------------
@@ -308,6 +323,15 @@ return [
     */
     'show_environment' => true,
 
+    /*
+    |--------------------------------------------------------------------------
+    | Menu bind to permission
+    |--------------------------------------------------------------------------
+    |
+    | whether enable menu bind to a permission
+    */
+    'menu_bind_permission' => true,
+
     /*
     |--------------------------------------------------------------------------
     | Enable default breadcrumb
@@ -331,6 +355,13 @@ return [
 
     ],
 
+    /*
+    |--------------------------------------------------------------------------
+    | Enable/Disable sidebar menu search
+    |--------------------------------------------------------------------------
+    */
+    'enable_menu_search' => true,
+
     /*
     |--------------------------------------------------------------------------
     | Alert message that will displayed on top of the page.
@@ -340,10 +371,10 @@ return [
 
     /*
     |--------------------------------------------------------------------------
-    | The global Table action display class.
+    | The global Grid action display class.
     |--------------------------------------------------------------------------
     */
-    'table_action_class' => \Encore\Admin\Table\Displayers\DropdownActions::class,
+    'grid_action_class' => \Encore\Admin\Grid\Displayers\DropdownActions::class,
 
     /*
     |--------------------------------------------------------------------------
@@ -365,6 +396,40 @@ return [
     |
     */
     'extensions' => [
+        'latlong' => [
+
+            // Whether to enable this extension, defaults to true
+            'enable' => true,
+
+            // Specify the default provider
+            'default' => 'tencent',
+
+            // According to the selected provider above, fill in the corresponding api_key
+            'providers' => [
+
+                'google' => [
+                    'api_key' => '',
+                ],
 
+                'yadex' => [
+                    'api_key' => '',
+                ],
+
+                'baidu' => [
+                    'api_key' => 'xck5u2lga9n1bZkiaXIHtMufWXQnVhdx',
+                ],
+
+                'tencent' => [
+                    'api_key' => 'KCFBZ-UOC3I-CAKGB-5FHGL-4G46Z-XJBC4',
+                ],
+
+                'amap' => [
+                    'api_key' => '3693fe745aea0df8852739dac08a22fb',
+                ],
+            ]
+        ],
+        'multitenancy' => [
+            'tenancy' => config_path('tenancy.php'),
+        ]
     ],
 ];

+ 2 - 2
config/app.php

xqd xqd
@@ -80,7 +80,7 @@ return [
     |
     */
 
-    'locale' => 'en',
+    'locale' => 'zh-CN',
 
     /*
     |--------------------------------------------------------------------------
@@ -93,7 +93,7 @@ return [
     |
     */
 
-    'fallback_locale' => 'en',
+    'fallback_locale' => 'zh-CN',
 
     /*
     |--------------------------------------------------------------------------

+ 6 - 0
config/filesystems.php

xqd
@@ -63,6 +63,12 @@ return [
             'bucket' => env('AWS_BUCKET'),
             'url' => env('AWS_URL'),
         ],
+        'admin' => [
+            'driver' => 'local',
+            'root' => public_path('upload'),
+            'visibility' => 'public',
+            'url' => '/upload/',
+        ],
 
     ],
 

+ 319 - 0
config/tenancy.php

xqd
@@ -0,0 +1,319 @@
+<?php
+
+return [
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin name
+    |--------------------------------------------------------------------------
+    |
+    | This value is the name of laravel-admin, This setting is displayed on the
+    | login page.
+    |
+    */
+    'name' => '超级妈力机构管理平台',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin logo
+    |--------------------------------------------------------------------------
+    |
+    | The logo of all admin pages. You can also set it as an image by using a
+    | `img` tag, eg '<img src="http://logo-url" alt="Admin logo">'.
+    |
+    */
+    'logo' => '<b>超级妈力</b> 管理平台',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin mini logo
+    |--------------------------------------------------------------------------
+    |
+    | The logo of all admin pages when the sidebar menu is collapsed. You can
+    | also set it as an image by using a `img` tag, eg
+    | '<img src="http://logo-url" alt="Admin logo">'.
+    |
+    */
+    'logo_mini' => '<b>超级妈力</b>',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin route settings
+    |--------------------------------------------------------------------------
+    |
+    | The routing configuration of the admin page, including the path prefix,
+    | the controller namespace, and the default middleware. If you want to
+    | access through the root path, just set the prefix to empty string.
+    |
+    */
+    'route' => [
+
+        'prefix' => 'cdms',
+
+        'namespace' => 'App\\Community\\Controllers',
+
+        'middleware' => ['web', 'admin','multi-session:path,/cdms'],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin install directory
+    |--------------------------------------------------------------------------
+    |
+    | The installation directory of the controller and routing configuration
+    | files of the administration page. The default is `app/Admin`, which must
+    | be set before running `artisan admin::install` to take effect.
+    |
+    */
+    'directory' => app_path('Community'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin html title
+    |--------------------------------------------------------------------------
+    |
+    | Html title for all pages.
+    |
+    */
+    'title' => '超级妈力',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Access via `https`
+    |--------------------------------------------------------------------------
+    |
+    | If your page is going to be accessed via https, set it to `true`.
+    |
+    */
+    'https' => env('ADMIN_HTTPS', false),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin auth setting
+    |--------------------------------------------------------------------------
+    |
+    | Authentication settings for all admin pages. Include an authentication
+    | guard and a user provider setting of authentication driver.
+    |
+    | You can specify a controller for `login` `logout` and other auth routes.
+    |
+    */
+    'auth' => [
+
+        'controller' => App\Community\Controllers\AuthController::class,
+
+        'guards' => [
+            'admin' => [
+                'driver'   => 'session',
+                'provider' => 'admin',
+            ],
+        ],
+
+        'providers' => [
+            'admin' => [
+                'driver' => 'eloquent',
+                'model'  => Encore\Admin\Auth\Database\Administrator::class,
+            ],
+        ],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin upload setting
+    |--------------------------------------------------------------------------
+    |
+    | File system configuration for form upload files and images, including
+    | disk and upload path.
+    |
+    */
+    'upload' => [
+
+        // Disk in `config/filesystem.php`.
+        'disk' => 'admin',
+
+        // Image and file upload path under the disk above.
+        'directory' => [
+            'image' => 'images',
+            'file'  => 'files',
+        ],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Laravel-admin database settings
+    |--------------------------------------------------------------------------
+    |
+    | Here are database settings for laravel-admin builtin model & tables.
+    |
+    */
+    'database' => [
+
+        // Database connection for following tables.
+        'connection' => '',
+
+        // User tables and model.
+        'users_table' => 'cdms_users',
+        'users_model' => Encore\Admin\Auth\Database\Administrator::class,
+
+        // Role table and model.
+        'roles_table' => 'cdms_roles',
+        'roles_model' => Encore\Admin\Auth\Database\Role::class,
+
+        // Permission table and model.
+        'permissions_table' => 'cdms_permissions',
+        'permissions_model' => Encore\Admin\Auth\Database\Permission::class,
+
+        // Menu table and model.
+        'menu_table' => 'cdms_menu',
+        'menu_model' => Encore\Admin\Auth\Database\Menu::class,
+
+        // Pivot table for table above.
+        'operation_log_table'    => 'cdms_operation_log',
+        'user_permissions_table' => 'cdms_user_permissions',
+        'role_users_table'       => 'cdms_role_users',
+        'role_permissions_table' => 'cdms__role_permissions',
+        'role_menu_table'        => 'cdms_role_menu',
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | User operation log setting
+    |--------------------------------------------------------------------------
+    |
+    | By setting this option to open or close operation log in laravel-admin.
+    |
+    */
+    'operation_log' => [
+
+        'enable' => true,
+
+        /*
+         * Only logging allowed methods in the list
+         */
+        'allowed_methods' => ['GET', 'HEAD', 'POST', 'PUT', 'DELETE', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH'],
+
+        /*
+         * Routes that will not log to database.
+         *
+         * All method to path like: admin/auth/logs
+         * or specific method to path like: get:admin/auth/logs.
+         */
+        'except' => [
+            'admin/auth/logs*',
+        ],
+    ],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Admin map field provider
+    |--------------------------------------------------------------------------
+    |
+    | Supported: "tencent", "google", "yandex".
+    |
+    */
+    'map_provider' => 'google',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Application Skin
+    |--------------------------------------------------------------------------
+    |
+    | This value is the skin of admin pages.
+    | @see https://adminlte.io/docs/2.4/layout
+    |
+    | Supported:
+    |    "skin-blue", "skin-blue-light", "skin-yellow", "skin-yellow-light",
+    |    "skin-green", "skin-green-light", "skin-purple", "skin-purple-light",
+    |    "skin-red", "skin-red-light", "skin-black", "skin-black-light".
+    |
+    */
+    'skin' => 'skin-blue-light',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Application layout
+    |--------------------------------------------------------------------------
+    |
+    | This value is the layout of admin pages.
+    | @see https://adminlte.io/docs/2.4/layout
+    |
+    | Supported: "fixed", "layout-boxed", "layout-top-nav", "sidebar-collapse",
+    | "sidebar-mini".
+    |
+    */
+    'layout' => ['sidebar-mini'],
+
+    /*
+    |--------------------------------------------------------------------------
+    | Login page background image
+    |--------------------------------------------------------------------------
+    |
+    | This value is used to set the background image of login page.
+    |
+    */
+    'login_background_image' => '',
+
+    /*
+    |--------------------------------------------------------------------------
+    | Show version at footer
+    |--------------------------------------------------------------------------
+    |
+    | Whether to display the version number of laravel-admim at the footer of
+    | each page
+    |
+    */
+    'show_version' => true,
+
+    /*
+    |--------------------------------------------------------------------------
+    | Show environment at footer
+    |--------------------------------------------------------------------------
+    |
+    | Whether to display the environment at the footer of each page
+    |
+    */
+    'show_environment' => true,
+
+    /*
+    |--------------------------------------------------------------------------
+    | Menu bind to permissionsymlink
+    |--------------------------------------------------------------------------
+    |
+    | whether enable menu bind to a permission
+    */
+    'menu_bind_permission' => true,
+
+    /*
+    |--------------------------------------------------------------------------
+    | Enable default breadcrumb
+    |--------------------------------------------------------------------------
+    |
+    | Whether enable default breadcrumb for every page content.
+    */
+    'enable_default_breadcrumb' => true,
+
+    /*
+    |--------------------------------------------------------------------------
+    | Extension Directory
+    |--------------------------------------------------------------------------
+    |
+    | When you use command `php artisan admin:extend` to generate extensions,
+    | the extension files will be generated in this directory.
+    */
+    'extension_dir' => app_path('Comuunity/Extensions'),
+
+    /*
+    |--------------------------------------------------------------------------
+    | Settings for extensions.
+    |--------------------------------------------------------------------------
+    |
+    | You can find all available extensions here
+    | https://github.com/laravel-admin-extensions.
+    |
+    */
+    'extensions' => [
+
+    ],
+    // 使用`下拉菜单`形式
+    'grid_action_class' => \Encore\Admin\Grid\Displayers\DropdownActions::class,
+];

+ 114 - 0
database/migrations/tenancy/2020_10_27_070314_create_tenancy_tables.php

xqd
@@ -0,0 +1,114 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateTenancyTables extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        $connection = config('tenancy.database.connection') ?: config('database.default');
+
+        Schema::connection($connection)->create(config('tenancy.database.users_table'), function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('username', 190)->unique();
+            $table->string('password', 60);
+            $table->string('name');
+            $table->string('avatar')->nullable();
+            $table->string('remember_token', 100)->nullable();
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.roles_table'), function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 50)->unique();
+            $table->string('slug', 50);
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.permissions_table'), function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('name', 50)->unique();
+            $table->string('slug', 50);
+            $table->string('http_method')->nullable();
+            $table->text('http_path');
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.menu_table'), function (Blueprint $table) {
+            $table->increments('id');
+            $table->integer('parent_id')->default(0);
+            $table->integer('order')->default(0);
+            $table->string('title', 50);
+            $table->string('icon', 50);
+            $table->string('uri', 50)->nullable();
+            $table->string('permission')->nullable();
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.role_users_table'), function (Blueprint $table) {
+            $table->integer('role_id');
+            $table->integer('user_id');
+            $table->index(['role_id', 'user_id']);
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.role_permissions_table'), function (Blueprint $table) {
+            $table->integer('role_id');
+            $table->integer('permission_id');
+            $table->index(['role_id', 'permission_id']);
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.user_permissions_table'), function (Blueprint $table) {
+            $table->integer('user_id');
+            $table->integer('permission_id');
+            $table->index(['user_id', 'permission_id']);
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.role_menu_table'), function (Blueprint $table) {
+            $table->integer('role_id');
+            $table->integer('menu_id');
+            $table->index(['role_id', 'menu_id']);
+            $table->timestamps();
+        });
+
+        Schema::connection($connection)->create(config('tenancy.database.operation_log_table'), function (Blueprint $table) {
+            $table->increments('id');
+            $table->integer('user_id');
+            $table->string('path');
+            $table->string('method', 10);
+            $table->string('ip');
+            $table->text('input');
+            $table->index('user_id');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        $connection = config('tenancy.database.connection') ?: config('database.default');
+
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.users_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.roles_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.permissions_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.menu_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.user_permissions_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.role_users_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.role_permissions_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.role_menu_table'));
+        Schema::connection($connection)->dropIfExists(config('tenancy.database.operation_log_table'));
+    }
+}