Skip to content
Advertisement

Laravel 8: Property [name] does not exist on this collection instance

I’m working with Laravel 8 to develop my project and in this project, I have a table named hostings which it’s migration goes here:

JavaScript

And now I want to return some results from the DB and show them on blade, so I added this:

JavaScript

But now I get this error:

JavaScript

So what is going wrong here? How can I fix this issue?

I would really appreciate if you share any idea or suggestion about this with me,

Thanks in advance.

Controller code:

JavaScript

Advertisement

Answer

as you have collection you need to loop over it to get value

JavaScript

else you can show all the host name in comma separated by this

JavaScript

or you can get first data of collection like this

JavaScript

ref link https://laravel.com/docs/8.x/collections#method-pluck

https://laravel.com/docs/8.x/collections#method-join

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement