Hi @martinbean, sorry I was away for the weekend and had no chance to try it...
First of all thanks for your input, I've given it another shot today and am still not sure, how to do it correctly.
The problem I struggle with is, that all examples on the Laravel docs are the inverse from what I need...
So for example the many-to-many polymorphic relation:
A tag BELONGS TO a post or a video. The problem starts, when I try to project it on my models...
The TAG is querying as follows:
public function posts()
{
return $this->morphedByMany('App\Post', 'taggable');
}
public function videos()
{
return $this->morphedByMany('App\Video', 'taggable');
}
And then in the POST it would be:
public function tags()
{
return $this->morphToMany('App\Tag', 'taggable');
}
But as said, this is the wrong way around...
For me it would be: A landingpage HAS MANY modules of different kinds. So as far as I understand it, I always need to query all relations (for each moduletype I implement). My guess is, that I need to merge the queries and can not do it with the build in eloquent relations?
I haven't found a way to get all relations automatically yet, I always have a problem with retrieving all relationships without calling then explicit (also with an interim modules model, because I need to call the individual moduletypes there too)...
Sorry, maybe I'm thinking way to complicated or still don't understand the eloquent relationships fully, but as said, from what I've read in the docs, my use-case is simply missing or at least not documented in a way that I understand it...
Maybe I'm to focused on the examples of the site and need to look more into the functionalities itself...
Any further nudge in the right direction is highly appreciated!