2条回答 默认 最新
- dongshi9526 2016-07-10 15:53关注
You need to define your relationships like below:
class Part extends Model { public function cards() { return $this->belongsToMany('App\Cards', 'user_cards'); } }
Then you can fetch all the cards for a part like below:
$cards = Part::with('cards')->find($part_id);
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报