//如果要隐藏关联模型的属性,可以使用
$list = User::with('profile')->select();
$list->hidden(['profile.email'])->toArray();
//隐藏多个
$list = User::with('profile')->select();
$list->hidden(['profile'=>['address','phone','email']])->toArray();
//显示关联属性
$list = User::with('profile')->select();
$list->visible(['profile'=>['address','phone','email']])->toArray();
//追加关联属性
//追加一个Profile模型的额外属性(非实际数据,可能是定义了获取器方法)
$list = User::with('profile')->select();
$list->append(['profile.status'])->toArray();
//追加一个额外关联对象的属性
$list = User::with('profile')->select();
$list->append(['Book.name'])->toArray();