1
When presenting multiple user data in a view, it is more advisable to do it in what way?
Option 1 (pass data to view):
$usuario = Auth::user();
return view('painel.usuarios.perfil', compact('usuario'));
Option 2 (directly in the view):
Auth::user()->name
Auth::user()->email
When I talk about the best option I am considering the good practices and especially the performance issue. Consider the Laravel 5.3 framework
Option 1 is very strange, I was confused, could it improve
– novic
It was my mistake, I forgot to replace User::user() by Auth::user()
– Fábio Jânio
You need that one
$usuario
( which is logged ), either in a view or in multiple views?– novic
Only one view.
– Fábio Jânio