Support the ongoing development of Laravel.io →
Eloquent Views
Last updated 2 years ago.
0

Can you post the error that comes with your code?

Some pointers what may be wrong:

  1. Is your Client Model in a Namespace? Then you need to write $this->belongsTo('App\Client'); (for example)

  2. Does your installation have a client_id column? If it is named differently you have to pass the name as second parameter to belongsTo() (like this: $this->belongsTo('Client', 'the_client_id');)

Your view looks correct so the error should be either in the relationship or in the database. But without an error message it's hard to pinpoint. :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

guldoe guldoe Joined 21 Aug 2015

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.