【发布时间】:2018-10-26 01:54:50
【问题描述】:
我有以下表格
表格检查
id
name ...
表设置类型
id
name
level //references id on table check
标签设置
type, //references type on table setting type
name
value
所以基本上我想用设置返回所有检查
所以我的模型中有
1.Check model //引用表检查
public function settingsval(){
return $this->hasMany('App\AppSettingTypes','name','name.setting');
}
在我的 AppSettingTypes // 引用表设置类型
public function settings(){
return $this->hasMany('App\AppSetting','id','type');
}
所以我的控制器上只是在做
CheckModel::with('settingsval')
但每次设置数组都是空的,即使有数据
可能出了什么问题?
【问题讨论】: