且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从laravel刀片访问JWT?

更新时间:2023-12-02 17:37:16

您可以像Auth一样使用JWTAuth:

You can use JWTAuth like Auth:

通过身份验证后,获得用户

After you authenticate, get the user

$user = JWTAuth::user();

然后传递数据以查看:

return view('posts', ['user' => $user]);

您可以使用刀片中的数据:

and you can use the data in blade:

{{ echo $user->id; }}