/** * @return bool */ public function isShittyRound() { $hitsInRound = Hit::where(['game_user_id' => $this->game->current_game_user_id, 'round' => $this->game->round])->fetchAll(); return Arrays::all($hitsInRound, function ($hit) { return !$this->isScored($hit->field, $hit->multiplier); }); }
/** * @return bool */ public function delete() { Hit::where(['game_user_id' => $this->id])->deleteAll(); return parent::delete(); }
/** * @param Game $game * @return Hit[] */ public static function findForGame(Game $game) { $gameUserIds = Arrays::map($game->game_users, Functions::extractId()); return Hit::where(['game_user_id' => $gameUserIds])->with('game_user->user')->order('id desc')->limit(9)->fetchAll(); }