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

Did you try with a properly defined Eloquent one-to-many relation and eager loading?
I think this wouldn't be affected by the issue.

Last updated 2 years ago.
0

Yes, my models look something like this:

class Author extends Eloquent
{
	public function books()
	{
		return $this->hasMany('Book');
	}
}

class Book extends Eloquent
{
	public function author()
	{
		return $this->belongsTo('Author');
	}

	public function test()
	{
		return 'Test';
	}
}

If you look at my examples above you'll see they are working fine, until I want to grab columns with the same name ("Slug" in this case).

Last updated 2 years ago.
0
$books = Book::with('author')->where('category_id', '=', 1)->get();
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Kyrst kyrst Joined 9 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.