plugins-world / laravel-jwt-auth
LaravelJwtAuth plugin made by mouyong
dev-master
2024-12-21 09:57 UTC
Requires
- php: >= 8.0
- tymon/jwt-auth: dev-develop
This package is auto-updated.
Last update: 2024-12-21 09:58:17 UTC
README
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Installation
You can install the package via composer:
php artisan market:require plugins-world/laravel-jwt-auth composer require plugins-world/laravel-jwt-auth
Usage
单独使用登录功能时,请在 auth()->login()
时使用 Plugins\LaravelJwtAuth\Models\User,示例如下:
use Plugins\LaravelJwtAuth\Models\User as JwtModelUser; $inputPassword = \request('password'); $user = \App\Models\User::first(); if (Hash::check($user->password, $inputPassword)) { // get_class($user) !== config('auth.providers.api.model') 配置的模型时, // 需要将 $user 转换成配置的模型。后续验证才能通过登录验证。 $token = auth('api')->login(new JwtModelUser($user->toArray())); }
Testing
composer test
How to create this package
php artisan new LaravelJwtAuth
Please see plugin-manager for more information.