Support the ongoing development of →
Database Eloquent Views
Last updated 1 year ago.

When you use DB('table_name')->get() it returns a Collection that means it is a Class you should use $item->name instead of $item['name']

But if you want keep use array syntax then change this line:

$data['items'] = DB::table('items')->get();

to be:

$data['items'] = DB::table('items')->get()->toArray() // Or ->all();

Got it, thanks for the clarification.


Sign in to participate in this thread!


Your banner here too?

Luke Ramus elramus Joined 26 Feb 2018


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

Your logo here?

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

© 2024 - All rights reserved.