我有汽车制造公司表格,上面有名称和总型号
在Make模型中,我有关系
public function category() {
return $this->belongsToMany('App\Category');
}
我想得到的是
Category::find($request->category_id)
->makes()
->orderBy('name')
->pluck('id', 'name');
类别模型具有
public function makes() {
return $this->belongsToMany('App\Make');
}
工作正常,我有一个ID和NAME,如何返回带有CONCATE名称||的函数make() total_models AS名称