Laravel - Property [title] does not exist on this collection instance


When you're using get() you get a collection. In this case you need to iterate over it to get properties:

@foreach ($collection as $object)
{{ $object->title }}
@endforeach
Or you could just get one of objects by it's index:

{{ $collection[0]->title }}
Or get first object from collection:

{{ $collection->first() }}
When you're using find() or first() you get an object, so you can get properties with simple:

{{ $object->title }}

 

https://stackoverflow.com/questions/41366092/laravel-property-title-does-not-exist-on-this-collection-instance


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM