Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 1 year ago.
0

I needed to use the FQN of the model for this to work. Solved.

Last updated 1 year ago.
0

davidxd33 said:

I needed to use the FQN of the model for this to work. Solved.

Have an example of working code?

Last updated 1 year ago.
0

mottihoresh said:

davidxd33 said:

I needed to use the FQN of the model for this to work. Solved.

Have an example of working code?

I imagine he changed:

return $this->belongsTo('User');

to:

return $this->belongsTo('App\User');

At least that's what I had to do. Is this the proper way to do this?

Last updated 1 year ago.
0

Any word on this? Only way my models work is if I prepend the app name before the model name

return $this->belongsTo('AppName\Company');
Last updated 9 years ago.
0

Thanks! you solved my problem

0

I'm having the same problem.. I already have my namespace App; declared on top of the Model. I heard about using the composer dump-autoload will fix the problem, but it doesn't work for mine. Adding the extra namespace for every line of code works but it looks little bit ugly.

Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

davidxd33 davidxd33 Joined 29 May 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.