hacklee / laravel5-multi-auth
laravel5 mutil auth
Installs: 4 256
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-11-13 07:20:43 UTC
README
ravel5 多个Auth实现 ###参考 https://github.com/ollieread/multiauth 写的4.2版思路
##使用composer加载到项目
- 修改composer.json 增加下面的require
"require": {
"hacklee/laravel5-multi-auth": "dev-master"
}
- 执行 composer update
##使用步骤
- 替换app.config 中的'Illuminate\Auth\AuthServiceProvider' 为 'Hacklee\Multiauth\XhAuthServiceProvider'
- 更改auth.php
配置示例:
<?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();