Php 查询中的联接透视数据(多对多多态关系)
我有多对多多态关系Php 查询中的联接透视数据(多对多多态关系),php,mysql,laravel,polymorphism,laravel-5.2,Php,Mysql,Laravel,Polymorphism,Laravel 5.2,我有多对多多态关系 post morphedByMany(postA) post morphedByMany(postB) post morphedByMany(postC) 我有一个postA和Post sort by'updated_at'的数组我使用以下方法得到了这个数组: $Post::has('postB',' postA morphToMany(post) postB morphToMany(post) postC morphToMany(post) @foreach($pos
post morphedByMany(postA)
post morphedByMany(postB)
post morphedByMany(postC)
我有一个postA和Post sort by'updated_at'的数组我使用以下方法得到了这个数组:
$Post::has('postB','
postA morphToMany(post)
postB morphToMany(post)
postC morphToMany(post)
@foreach($posts as $post)
@if($post is postA)
{{"post a"}}
@elseif($post is postC)
{{"post c"}}
@endif
@endforeach