Skip to content

Commit

Permalink
增加用户模型的缓存驱动
Browse files Browse the repository at this point in the history
  • Loading branch information
cjango committed Aug 27, 2021
1 parent e497c7a commit 3025a88
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"require": {
"php": ">=7.4.0",
"laravel/framework": "^8.56",
"laravel/sanctum": "^2.11"
"laravel/sanctum": "^2.11",
"yangjisen/laravel-cache-provider": "^3.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 3 additions & 0 deletions src/Console/ApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ protected function publishConfig()
$this->call('vendor:publish', [
'--provider' => 'Jason\Api\ApiServiceProvider',
]);
$this->call('vendor:publish', [
'--provider' => 'YangJiSen\CacheUserProvider\ServiceProvider',
]);
$this->call('migrate');
}

Expand Down
1 change: 1 addition & 0 deletions src/Console/stubs/Controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ class Controller extends BaseController
{

use ApiResponse;

}
7 changes: 7 additions & 0 deletions src/Listeners/LoginListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
class LoginListener
{

/**
* Notes : 登录成功后,自动删除原有的token
* 这样大概能做到单点登录的效果
* @Date : 2021/8/27 9:40 上午
* @Author : <Jason.C>
* @param $event
*/
public function handle($event)
{
if (config('api.token_auto_revoke')) {
Expand Down

0 comments on commit 3025a88

Please sign in to comment.