Laravel 5.3 - htmlspecialchars() expects parameter 1 to be string
I think your $user->website
is empty/blank.
If you look at the url()
helper method, Laravel will return an instance of UrlGenerator
if $path
is null.
So in your case if $user->website
is empty, you'd get UrlGenerator
back and thus your error about htmlspecialchars
getting an object.
One simple solution would be to wrap your html chunk with a check:
@if($user->website)
<li>
...
</li>
@endif
I was getting this because in my view I was using $errors->get('username')
to show errors but get()
returns an array. Switching to $errors->first('username')
fixed this.
In my case, i used a function inside blade file like $brand->products()
and it was returning array, thats why i was seeing the message.
when i changed my code and returning string, the error was gone.