Support the ongoing development of Laravel.io →
Views Blade
Last updated 2 years ago.
0

You're getting this error because your Eloquent query is using the get() method, which is designed for getting multiple records. In your case, you're getting one record back, but because you're using get(), it's wrapping it inside an array which is why you can't access the name variable directly (when dealing with multiple records you'd normally loop through the returned collection).

However - in your case, you should use first() instead of get(), as you just want one record (the first match).

Last updated 9 years ago.
0

Thank you so much!!!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Polinicles polinicles Joined 26 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.