Wallogit.com
2017 © Pedro Peláez
laravel5 mutil auth
- 修改composer.json 增加下面的require
"require": {
"hacklee/laravel5-multi-auth": "dev-master"
}
- 执行 composer update
- 替换app.config 中的'Illuminate\Auth\AuthServiceProvider' 为 'Hacklee\Multiauth\XhAuthServiceProvider'
- 更改auth.php
配置示例:, (*2)
<?php
return [
'cp' => [
'driver' => 'cp',
'model' => 'App\CpUser',
'table' => 'cp_user',
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60
]
],
'op' => [
'driver' => 'op',
'model' => 'App\OpUser',
'table' => 'op_user',
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60
]
],
'api' => [
'driver' => 'api',
'model' => 'App\ApiUser',
'table' => 'api_user',
'password' => [
'email' => 'emails.password',
'table' => 'password_resets',
'expire' => 60
]
]
];
Auth::cp()->attempt(); Auth::api()->attempt(); Auth::op()->attempt();