Closed emredoganm closed 8 years ago
Which version are you using?
My Laravel version is 5.1 and NeoEloquent version is 1.3.0
is the relationship method name you use to define it a composite name like fictionBooks()
for instance? or is it a simple one like books()
or fiction()
?
Simple one. I am using friends()...
Since it is a relationships between nodes of the same Model class you should use hasMany
instead of belongsToMany
. This should solve it.
I have a relationship between two users like below:
public function friends(){ return $this->belongsToMany("App\Models\User",Config::get('relations.user_to_user')); }
and with this relationship I want to use a query like this :
$user->friends()->orderBy("first_name","ASC")->get()
but I get same result. I think in relationships "orderBy" not working. I got no error.