Support the ongoing development of Laravel.io →
Database Views
Last updated 1 year ago.
0

Hi.

First, the View::with takes 2 arguments, not three. So you would have to do like ->with('recording', $recording)->with('credits', $credits);

But i REALLY think that eloquent relationships is what you seek here. Read more at http://laravel.com/docs/eloquent#relationships

Last updated 1 year ago.
0

Thanks for the suggestion. I've looked at that page and I haven't been able to get relationships to work that way.

I'm assuming (based on this page) that this: return $this->hasOne('Phone'); needs a second class in the model since Phone is the name of a class. At least that's how I'm reading it. Is this correct?

Also, I don't understand how to display the results from credits.

So, to break it down, I've got:

Song Title [related songs_titles table] Recording Info [recording table]

Credit A [related credits table which is related to a names table and a roles table] Credit B [related credits table which is related to a names table and a roles table] Credit C [related credits table which is related to a names table and a roles table] Credit D [related credits table which is related to a names table and a roles table] etc.

Along with other related info on the page that will have to be displays like Credits.

Am I missing something that's obvious in the documentation?

Last updated 1 year ago.
0

Could you show the structure of database first?

Last updated 1 year ago.
0

Yes, here it is.

recordings
id
song_title_id
info

song_title
id
song_title

credits
id
recording_id
name_id
role_id

names
id
name

roles
id
role

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jerauf jerauf Joined 16 Feb 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.