Authentication Laravel Auth::user()获取属性
当iAuthentication Laravel Auth::user()获取属性,authentication,laravel-5,Authentication,Laravel 5,当idump(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"
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 [▶]
....
}
在受保护的属性中,我们看到了来自用户表的信息
如何获取#属性
?
或者告诉我如何获取有关已登录用户的所有信息。Auth::User()->name
Auth::user()->电子邮件
等等
这将获得登录用户的所有属性
Auth::User()->getAttributes();