I receive the name of the logged in user with the following code:
{{ Auth::guard('profesor')->user()->nombre }}
I want to concatenate with the last name, how can I do it?
It should be possible to solve with accessors in the model:
public function getNombreCompletoAttribute()
{
return $this->nombre . ' ' . $this->apellido;
}
and you call it in the view:
{{ Auth::guard('profesor')->user()->nombre_completo }}
See more information in the documentation: link