src/lib/Http/Controllers/InventoryController.php
public function getBidding()
    {
        $items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
            return $query->where('user_id', Auth::user()->userId);
        });

        $items = Item::typeAuction()->active()->leftJoin('bids')->where(
            'bids.user_id',
            Auth::user()->userId
        )->addSelect(
            DB::raw('max(`bids`.`amount`) as `max_bid`')
        )->addSelect(
            DB::raw('count(`bids`.`bid_id`) as `bid_count`')
        )->groupBy('items.item_id');

        $table = new InventoryBidding($items);

        return view('mustard::inventory.bidding', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
public function getBidding()
    {
        $items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
            return $query->where('user_id', Auth::user()->userId);
        });

        $items = Item::typeAuction()->active()->leftJoin('bids')->where(
            'bids.user_id',
            Auth::user()->userId
        )->addSelect(
            DB::raw('max(`bids`.`amount`) as `max_bid`')
        )->addSelect(
            DB::raw('count(`bids`.`bid_id`) as `bid_count`')
        )->groupBy('items.item_id');

        $table = new InventoryBidding($items);

        return view('mustard::inventory.bidding', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }
public function getBidding ( ) { $ items = Item :: typeAuction ( ) -> active ( ) -> whereHas ( 'bids' , function ( $ query ) { return $ query -> where ( 'user_id' , Auth :: user ( ) -> userId ) ; } ) ; $ items = Item :: typeAuction ( ) -> active ( ) -> leftJoin ( 'bids' ) -> where ( 'bids.user_id' , Auth :: user ( ) -> userId ) -> addSelect ( DB :: raw ( 'max(`bids`.`amount`) as `max_bid`' ) ) -> addSelect ( DB :: raw ( 'count(`bids`.`bid_id`) as `bid_count`' ) ) -> groupBy ( 'items.item_id' ) ; $ table = new InventoryBidding ( $ items ) ; return view ( 'mustard::inventory.bidding' , [ 'table' => $ table , 'items' => $ table -> paginate ( ) , ] ) ; }
Return the inventory bidding items view.

@return \Illuminate\View\View
Return the inventory bidding items view .