Php Laravel-检索相关的模型属性
我有一个使用以下查询检索的数据集集合:Php Laravel-检索相关的模型属性,php,laravel,laravel-4,Php,Laravel,Laravel 4,我有一个使用以下查询检索的数据集集合: Profile::where('profile.role', '=', 'hcp')->get(); 配置文件模型与名为“用户”的模型具有“hasOne”关系。我希望上面的查询也返回“User”属性 我如何才能做到这一点?尝试使用: Profile::with('user')->where('profile.role', '=', 'hcp')->get(); 有关详细信息,请查看上的文档。尝试使用: Profile::with('u
Profile::where('profile.role', '=', 'hcp')->get();
配置文件模型与名为“用户”的模型具有“hasOne”关系。我希望上面的查询也返回“User”属性
我如何才能做到这一点?尝试使用:
Profile::with('user')->where('profile.role', '=', 'hcp')->get();
有关详细信息,请查看上的文档。尝试使用:
Profile::with('user')->where('profile.role', '=', 'hcp')->get();
查看上的文档以了解更多信息。阅读文档。有一个“with”方法。请阅读文档。有一个“with”方法。非常感谢Bogdan!:非常感谢Bogdan!: