Reputation: 2153
I use MongoDB with Laravel: https://github.com/jenssegers/laravel-mongodb
I have two tables (feeds, users) and a collection on MongoDB (articles) that come in this form:
articles (MongoDB):
- _id (ObjectID)
- feed_id
- title
feeds (MySQL):
- id
- user_id
- name
users (MySQL):
- id
- name
I would like to retrieve all the articles of a user while passing by "feeds".
For this, I use the hasManyThrough() relation in the User model:
public function articles()
{
return $this->hasManyThrough(
Article::class,
Feed::class,
'user_id',
'feed_id',
'_id',
'id'
);
}
But the problem is that on each user, I have the same articles listed, it looks like it does not take into account user_id...
Upvotes: 1
Views: 481
Reputation: 92
https://github.com/jenssegers/laravel-mongodb package not supporting
$this->hasManyThrough
- relation .
Relations Supported relations are:
You can check documentation : https://github.com/jenssegers/laravel-mongodb
Upvotes: 1