php - 如何在 Laravel sql 数据库关系中使用 where 子句
问题描述
我想使用来自学生功能的 national where equals national_id 搜索最后的道歉,我该怎么做?
我试过了:
return [
'Students' => function ($students){
$students->select('id', 'username','national_id', 'is_foreigner', 'college_id')
->with([
'Apologies' => function ($apologies) use ($students) {
$apologies->select('student_id', 'reasons');
->where('national', 'students.national_id');
}
]);
}
]
解决方案
推荐阅读
- c++ - 在这个特定问题中,c++ 如何处理溢出?
- oracle - 我可以在没有 Oracle JDBC 驱动程序的情况下连接到 Oracle 数据库吗?
- c - 在使用堆栈方面,为什么我们需要一个基指针和一个堆栈指针
- python - 创建一个语音识别循环
- scala - 如何正确聚合 Seq 中的对象?
- user-interface - 您通常如何对语言选择进行编程
- android - 我可以在 Google Play 控制台上发布 Mit 许可的 android 应用程序(从 github 下载)吗?
- python - 重复函数“x”次的递归
- excel - 在 VBA 中查找数组中的匹配值
- r - 使用 GGPLOT2 的密度图问题