Fork me on GitHub

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

posted @ 2017-05-23 15:21  思考的大腿  阅读(4899)  评论(0编辑  收藏  举报