public static function remind(Auction $auction) { // Get all subscribers for the auction $subscribers = AuctionReminder::where('auction_id', $auction->id)->get(); // Remind each of them $subscribers->each(function ($subscriber) use($auction) { self::send($subscriber, $auction); }); }
/** * @param User $user * @return bool */ public function reminding(User $user) { if (!$user->isPlayer()) { return false; } return AuctionReminder::where('auction_id', $this->id)->where('player_id', $user->player_id)->get()->count() != 0; }
private function getOldReminder(Player $player, Auction $auction, $type) { return AuctionReminder::where('player_id', $player->id)->where('auction_id', $auction->id)->where('reminder_type', $type)->first(); }