Laravel 动态数据库关系

Laravel Dynamic DB Relation

我没有找到任何解决方案,所以我在这里问..

Match.php 
id , teams           name
1    5,6(string)   kkr vs mi
Team.php 
id  name 
5   kkr
6   mi

Team 的 id 与 Match 中的团队相关,为此解决方案很简单..但问题是一场 Match 可以有 3/4+ 没有团队所以我必须让它动态......

根据@maki10 的工作解决方案是

public function teams() {
      return $this->hasManyThrough(
         'App\model\Team',
         'App\model\MatchTeam',
         'match_id',
         'id',
         'id',
         'team_id'
      );
    }