In Laravel's many-to-many polymorphic relations, there is a situation where you can't get ALL records of different models by their "parent" record. Let me explain, and show the potential solution.
Scenario: you have multiple Models that each may have multiple tags.
Example Tags: "eloquent", "vue", "livewire"
And then each Post, Video, and Course may have many tags.
Our Task: get all records (Posts + Videos + Courses) by a specific tag.
Unfortunately, there's nothing like $tag->taggables()->get()
. You will see the solution for this below, but...