kankai
267
3
Laravel

Get looping data failed sometimes

Posted 5 months ago by kankai

Hi All,

I have facing this problem when i use query parameter grouping, in my form i have search an UID : 12345 which is contain IDA, IDB, IDC. So i need to get both of this three ID data, at the end i found out some UID can get all IDs data but some only get first ID data.

$UID = $request->player_id;
$tags = DB::table('game_id')->where('status',0)->where('wallet',$UID)->pluck('game_id');

 $gameData = id_data::where(function($query) use($tags)
                    {
                        foreach($tags as $tags)
                        {
                            $query->where('game_id',$tags)->orWhere('game_id', $tags);
                        }
                    })->orderBy('created_at','dsc')->get();

Is there something wrong with my code? Please help me, thank you very much.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.