/** * @param $auctionId * @param $playerId * @return mixed */ public function getByAuction($auctionId, $playerId = null) { if ($playerId == null) { $playerId = \Auth::user()->player->id; } return Bid::where('player_id', $playerId)->where('auction_id', $auctionId)->get(); }
/** * @param Auction $auction * @return mixed */ public static function flush(Auction $auction) { return Bid::where('auction_id', $auction->id)->delete(); }
public function lastNBids($number) { return Bid::where('auction_id', $this->id)->orderBy('created_at', 'DESC')->take($number)->get(); }