amirilidan78 / auth-token
简单的 Laravel 身份验证包
dev-main
2022-04-11 07:16 UTC
This package is auto-updated.
Last update: 2024-09-11 12:39:51 UTC
README
简单的 Laravel 身份验证包
安装
composer require amirilidan78/auth-token:dev-main
发布迁移
php artisan vendor:publish --tag=auth-token-migration
发布配置文件
php artisan vendor:publish --tag=auth-token-config
文档
从 Amirilidan78\AuthToken\Services
导入 AuthService
AuthService::create_auth_token
使用此函数创建令牌
函数返回令牌:字符串
可接受的请求头 Auth {$token}
AuthService::get_auth_token_from_request
函数从用户请求中提取身份验证令牌
函数返回身份验证令牌:字符串|null
AuthService::validate_token
函数验证请求身份验证令牌,您应该为该函数指定守卫,守卫是字符串,如 user
、admin
、...
函数返回身份验证令牌:字符串|null
AuthService::logout
函数从数据库中删除身份验证令牌
函数返回身份验证令牌:字符串|null
AuthService::remove_expired_auth_tokens
函数移除所有过期的令牌,过期令牌配置键是 token_auth.token_expire_minutes
函数返回身份验证令牌:字符串|null
Middleware::authentication
使用带有守卫的中间件 authentication 来保护路由
示例 ->middleware(['authentication:user'])