我使用以下功能从 schedul 表格中选择最后一个ID但是没有cocrrected
'loan'=>function($s) {
$s->with(['schedule'=>function($schedule){
$schedule->select(DB::raw('loan_id, schedule_date, principal as schedule_principal','max(id) as id'));
}]);
}]);
答案 0 :(得分:0)
将select
更改为:
DB::raw('loan_id, schedule_date, principal as schedule_principal, max(id) as id')