I am new to laravel and I like it. While working on a project on social networks, I got this error: htmlspecialchars() expects parameter 1 to be string, object given (View: C:\wamp64\www\histoirevraie\resources\views\user\profile.blade.php)
I checked a few questions on this site, but I did not find a question that solves my problem.
this is what my profile.blade.php consists of:
<ul class="profile-rows"> <li> <span class="the-label">Last visit: </span> <span class="the-value mark green">{{ \Carbon\Carbon::createFromFormat('Ymd H:i:s', $user->lastVisit)->diffForHumans(\Carbon\Carbon::now())}}</span> </li> <li> <span class="the-label">Member since: </span> <span class="the-value mark light-gray">{{ $user->created_at->format('F Y') }}</span> </li> <li> <span class="the-label">Profile views: </span> <span class="the-value mark light-gray">5146</span> </li> <li> <span class="the-label">Living In: </span> <span class="the-value">{{ $user->town }}</span> </li> <li> <span class="the-label">Website: </span> <span class="the-value"><a href="{{ url($user->website) }}">{{ $user->website }}</a></span> </li> </ul>
All user information is provided by the controller:
public function index($username){ $user = User::where('username', $username)->first(); return view('user.profile', compact('user')); }
Please help me solve this problem!
Prince
source share