Htmlspecialchars() expects parameter 1 to be string, object given (laravel)

Hello,

I am having an error with my laravel project.

This is my code for userpage.blade.php:

@include('head')
<br><br>
<h1>{{ $username }}</h1>

I guess we should start with the obvious: is $username a string or an object? If it is an object then does it have a __toString() method?

1 Like

Yep, very good point. Used print_r to find that out. Thanks!