【发布时间】:2019-01-18 12:21:53
【问题描述】:
您好,我想针对每个品牌选择 3 个模型,我在控制器中使用此代码
$brand = Brand::with (['models' => function ($q){
$q->take(3);
}])->get()->toArray();
但是第一品牌只需要3个型号不是全部Here is the image of my dd command 所以告诉我如何为所有品牌选择 3 种型号。
【问题讨论】:
标签: sql database laravel eloquent