以下是我的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();
当我在使用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
答案 0 :(得分:3)
$statusCondition
应该是一个数组。
替换
$statusCondition = '[1]';
与
$statusCondition = [1];