【发布时间】:2018-09-11 14:40:31
【问题描述】:
我有一个控制器,里面有一个字符串
$models = Model::with('table1', 'table2', 'table3', 'table4', 'table5')
->where('name', 'hello')->get();
问题是字段name 包含在所有表中。我如何指定所需的?我试过这个:
->where('table3.name', 'hello')->get();
但我收到一个错误 - 找不到字段
【问题讨论】:
-
table3是关系而不是表名吗?
标签: php mysql database laravel controller