Level 122
it's fine to access it directly since the framework already holds the authenticated user
no point in creating a temporary variable for this
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So, let's say I want to show username of a logged in user - "Welcome to the site, John"
I'm just wondering what approach would be better, putting
Welcome to the site, {{Auth::user()->username}} into the blade template or getting that info through a controller and then showing it with Welcome to the site, {{$username}}
I know it's a basic example, but I'm trying to figure out the best approach.
it's fine to access it directly since the framework already holds the authenticated user
no point in creating a temporary variable for this
Please or to participate in this conversation.