一崎脉、創(chuàng)建項(xiàng)目和基本設(shè)置
$ cd /var/www/html
$ laravel new mes
$ chmod -R 777 storage
$ chmod -R 777 bootstrap/cache
mes
is short for Manufacturing execution systems
二糕篇、安裝 Entrust
2.1 在 composer.json
中加入 "zizaco/entrust": "5.2.x-dev"
古胆,然后運(yùn)行命令 composer update
2.2 在 config/app.php
中加入 providers 和 aliases
Zizaco\Entrust\EntrustServiceProvider::class,
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
2.3 拷貝相關(guān)文件
$ php artisan vender:publish
執(zhí)行以下動作
Copied Directory [/vendor/laravel/framework/src/Illuminate/Notifications/resources/views] To [/resources/views/vendor/notifications]
Copied Directory [/vendor/laravel/framework/src/Illuminate/Pagination/resources/views] To [/resources/views/vendor/pagination]
Copied File [/vendor/zizaco/entrust/src/config/config.php] To [/config/entrust.php]
Copied Directory [/vendor/laravel/framework/src/Illuminate/Mail/resources/views] To [/resources/views/vendor/mail]
Publishing complete.
三、修改 Model 目錄
$ mkdir app/Models
$ mkdir app/Models/User
$ mv app/User.php app/Models/User
修改 app/Models/User/User.php
的命名空間: namespace App\Models\User;
修改 config/auth.php
的模型: 'model' => App\Models\User\User::class,
修改 config/entrust.php
的模型:'role' => 'App\Models\User\Role',
'permission' => 'App\Models\User\Permission',