且构网

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

获取所有用户,除了laravel口外的当前登录用户

更新时间:2023-12-03 22:27:46

您可以使用auth()->id()获取当前用户的ID.然后将其传递给查询:

You can get the current user's id with auth()->id(). Then pass that to the query:

$users = User::where('id', '!=', auth()->id())->get();