Open your config/app.php and add the following to the providers array:
Sco\Admin\Providers\AdminServiceProvider::class,
Zizaco\Entrust\EntrustServiceProvider::class,
In the same config/app.php and add the following to the aliases array:
'Entrust' => Zizaco\Entrust\EntrustFacade::class,
php artisan vendor:publish --provider="Sco\Admin\Providers\AdminServiceProvider"
php artisan migrate
php artisan db:seed --class=AdminTableSeeder
auth.php
// 增加guard
'guards' => [
......
'admin' => [
'driver' => 'session',
'provider' => 'admin',
],
],
// 增加 providers
'providers' => [
......
'admin' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
],
如果guard名字不是“admin”,则config/scoadmin.php中的guard也需要修改
User Model引入EntrustUserTrait
use Sco\Admin\Traits\AdminUserTrait;
use Zizaco\Entrust\Traits\EntrustUserTrait;
class User
{
use EntrustUserTrait, AdminUserTrait;
}