Support the ongoing development of Laravel.io →
Requests Eloquent Database
Last updated 2 months ago.
0

I'm really not sure what you are trying to accomplish. If you only have one Piano in your Instruments table you can use the method ->first() instead of ->get() and you will get the object representing that row and use it like you do now (without the foreach part) in your view.

If you want to get all instruments in your table simply do Instrument::all() and you get all of them and can cycle through them in a foreach loop.

0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

Asumii Asumii asumii Joined 22 Nov 2015

Moderators

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.

© 2022 Laravel.io - All rights reserved.