authentication - Laravel Auth::user() 获取属性

标签 authentication laravel-5

当我 dump( Auth::user());那给我看

User {#220 ▼

  #attributes: array:10 [▼
    "id" => "8"
    "name" => "Vitaliy"
    "email" => "dsadsa@i.ua"
    "password" => "=)"
    "remember_token" => null
    "created_at" => "2017-10-19 13:11:21"
    "updated_at" => "2017-10-19 13:11:21"
    "phone" => "412412412"
    "city" => "Dnipro"
    "district" => "Leneinskiy"
  ]
  #original: array:10 [▶]
 ....
}

在 protected 属性(property)中,我们看到了来自用户表的信息
我如何获得 #attributes ?
或者请说我如何获取有关已登录用户的所有信息。

最佳答案

Auth::user()->nameAuth::user()->email
等等...

关于authentication - Laravel Auth::user() 获取属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46831749/

相关文章:

c# - 指定 Azure 移动应用网站登录的重定向 url

python - Django 启用密码哈希器以进行自定义身份验证

asp.net - MVC 5 访问声明身份用户数据

angularjs - 如何防止客户修改 Firebase 数据(在没有后端的 Web 应用程序中)?

php - 在Laravel中whereraw与DB::raw

php - 如何在具有多个数据库的 Laravel 5.7 应用程序中从替代数据库获取特定数据

mysql - Laravel 5 的身份验证问题

azure - 权限不在有效列表中 : 'authority' is not in the list of valid addresses

php - 如何使用 Laravel Dusk 创建用于测试的 .env 文件

php - Laravel 5.3 存储和读取文件目录