简体   繁体   English

Laravel whereIn在Grammar.php第118行中带有where子句ErrorException:

[英]Laravel whereIn with a where clause ErrorException in Grammar.php line 118:

Below is my laravel query: 以下是我的Laravel查询:

$statusCondition = '[1]';

$users = DB::table('user_tracking')
                 ->join('user_detail', 'user_tracking.user_id', '=', 'user_detail.id')
                 ->select('user_tracking.*', 'user_detail.gender', 'user_detail.username', 'user_detail.auth_provider')
                 ->where('user_tracking.art_id','=','1')
                 ->where('user_tracking.visit_start_date','>',DB::raw('NOW()-INTERVAL 24 HOUR'))
                 ->whereIn('user_tracking.status',$statusCondition)
                 ->get();

When I'm using whereIn then given below error can anyone help to resolved such issue: 当我使用whereIn然后给出以下错误时,任何人都可以帮助解决此类问题:

ErrorException in Grammar.php line 118: Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, called in /var/sites/l/letsnurture.co.uk/public_html/demo/museum/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 315 and defined

$statusCondition should be an array. $statusCondition应该是一个数组。

Replace 更换

$statusCondition = '[1]';

with

$statusCondition = [1];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Laravel范围查询抛出Grammar.php异常 - Laravel Scope Query throwing Grammar.php exception Laravel whereIn在每个数组项上带有where子句 - Laravel whereIn with a where clause on each array item Laravel 9 事件队列:Illuminate\Database\Grammar::parameterize():参数 #1 ($values) 必须是数组类型,int 给定,在 Grammar.php 中调用 - Laravel 9 Event Queue: Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, int given, called in Grammar.php Laravel 4:可选的 where 子句 - Laravel 4: optional wherein clause Laravel在whereIn子句中的限制 - Laravel limit in whereIn clause StreamBuffer.php第95行中的ErrorException:在laravel 5中 - ErrorException in StreamBuffer.php line 95: in laravel 5 Collection.php行1043中的ErrorException:未定义的偏移量:在laravel中为0 - ErrorException in Collection.php line 1043: Undefined offset: 0 in laravel Laravel 5.3分页-Collection.php第432行中的ErrorException - Laravel 5.3 Pagination - ErrorException in Collection.php line 432 laravel 5.3:UrlGenerator.php第314行中的ErrorException:未定义路由[] - laravel 5.3: ErrorException in UrlGenerator.php line 314: Route [] not defined Laravel 5.3 - ClassLoader.php第414行中的ErrorException - Laravel 5.3 - ErrorException in ClassLoader.php line 414
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM