Your getRole() method is not returning a single Role instance; it returns a Collection of stdClass instances; these are unrelated to the authenticated user; it will return the role for every user. It seems that this is not what you intend.
If you can use Eloquent relations instead of a query, then you can get the authenticated user's role (assuming your have a role_id on the users table) using a belongsTo relationship:
public function role()
{
return $this->belongsTo(Role::class);
}
If you wanted, you could then add a getter to your User model to get the role name only:
public function getRole()
{
return optional($this->role)->name;
}
The optional helper will return null rather than throwing a Trying to get property of non-object error when there is no role associated with the user.