LARAVEL 5 :: Display 'username' on homepage?

拟墨画扇 提交于 2021-02-07 14:31:24

问题


So the new version of Laravel has a login and register system already built in and so I've changed some fields in the register page and now want the 'username' to be displayed instead of the 'name' on the homepage after login. Does anyone have a clue where this is attributed? Have been searching endlessly for this. Thanks.


回答1:


The file you are looking for, is the app view file. This file defines a sample basic template for your website.
It is located here: resources/views/app.blade.php
In your case, you need to change {{ Auth::user()->name }} to {{ Auth::user()->username }}




回答2:


You can find logged user name with this below code

in any blade template you just write

@if (Auth::user()->name=="user_name")
    //your code after prove authentication                       
@endif


来源:https://stackoverflow.com/questions/28650067/laravel-5-display-username-on-homepage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!