gpt4 book ai didi

php - Laravel 4 Fluent Query Builder - stdClass 类的对象无法转换为字符串

转载 作者:行者123 更新时间:2023-11-30 00:43:58 25 4
gpt4 key购买 nike

实际上我想使用以下查询:

Select userid,username from users where userid not in (Select distinct fkuserid from staff);

为此,我使用了:
$result=DB::table('users') -> whereNOTIN('userid',DB::table('staff') -> distinct() -> get(array('fkuserid'))) -> get(); 

但它给出了类 stdClass 的对象无法转换为字符串的错误。

最佳答案

我正在研究 L3,它缺少我现在在 L4 文档中找到的内容。尝试:

$result=DB::table('users') -> whereNotIn('userid',DB::table('staff') -> distinct() -> lists('fkuserid')) -> get();

lists() 方法应该(我认为)只返回一个 id 数组,正如我在评论中所写的那样。

关于php - Laravel 4 Fluent Query Builder - stdClass 类的对象无法转换为字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21545372/

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