gpt4 book ai didi

mysql - JoinClause.php 第 79 行中的 InvalidArgumentException : Not enough arguments for the on clause

转载 作者:行者123 更新时间:2023-11-28 23:37:42 30 4
gpt4 key购买 nike

我用 laravel 做了查询生成器,我在其中使用了多重连接。执行查询时,出现错误 Not enough arguments for the on clause.我的查询构建器:

return DB::table('towns_cat_rel')
->join('towns', function ($join) {
$join->on('towns_cat_rel.town_id', '=', 'towns.id')
->where('publish', '=', 1);
})
->join('towns_translations', function ($join) {
$join->on('towns_cat_rel.town_id', '=', 'towns_translations.town_id')
->where('locale', '=', \App::getLocale());
})
->join('towns_cat', function ($join) use($categoryID) {
$join->on('towns_cat.id', '=', 'towns_cat_rel.town_cat_id')
->where('towns_cat.id', '=', $categoryID);
})
->join('towns_sub_cat_rel', 'towns_cat_rel.town_id', '=', 'towns_sub_cat_rel.town_id')
->join('towns_sub_cat', function ($join) use($subCategoryID) {
$join->on('towns_sub_cat_rel.town_sub_cat_id', 'towns_sub_cat.id')
->where('towns_sub_cat.id', '=', $subCategoryID);
})
->get();

有人知道为什么会这样吗?

最佳答案

抱歉各位!我忘记了上次连接中的 '=' => $join->on('towns_sub_cat_rel.town_sub_cat_id', '=', 'towns_sub_cat.id')现在一切正常!

关于mysql - JoinClause.php 第 79 行中的 InvalidArgumentException : Not enough arguments for the on clause,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35336137/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com