php - iterating in groups resulted by a group by SQL statement

381

is there any way to iterate in groups grouped by a select statement?

      $bidsInPeriod = DB::table('bids')
        ->select('bundle_id','owner_id','target','bid', DB::raw('count(*) as total'))
        ->where('submit_time','<',$i)
        ->whereRaw('? + run_time < deadline_time', array($i-3600))
        ->where('owner_id',$this->userId)
        ->where('status',0)
        ->groupBy('bundle_id')->get();
    foreach($bidsInPeriod as $bundle){
        $tmpBundle=new bundle($bundle['bundle_id'],$bundle['bid']);
        $bidRecords=bidsM::where('bundle_id','=',$i)->get();
        foreach($bidRecords as $bid){
            $tmpBundle->addBid($bid);
        }

People are also looking for solutions to the problem: php - Uploading to a domain with WordPress extension

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.