1、权限认证方面: https://packagist.org/packages/spatie/laravel-permission
用户认证
HTTP本身是无状态,通常在系统交互的过程中,使用账号或者Token标识来确定认证用户;
配置文件解读
return [
‘defaults‘ => [
‘guard‘ => ‘web‘,
...
],
‘guards‘ => [
‘web‘ => [
‘driver‘ => ‘session‘,
‘provider‘ => ‘users‘,
],
‘api‘ => [
‘driver‘ => ‘token‘,
‘provider‘ => ‘users‘,
],
],
‘providers‘ => [
‘users‘ => [
‘driver‘ => ‘eloquent‘,
‘model‘ => App\User::class,
],
],
],
];
从下往上,理解;
providers是提供用户数据的接口,要标注驱动对象和目标对象;此处,键名users是一套provider的名字,采用eloquent驱动,modal是App\User::class;
guards部分针对认证管理部分进行配置;有两种认证方式,一种叫web,还有一种是api;web认证是基于Session交互,根据sessionId获取用户id,在users这个provider查询出此用户;
api认证是基于token值交互,也采用users这个provider;
defaults项显示默认使用web认证;
2、无限极分类:
https://packagist.org/packages/baum/baum