Всем привет,у меня такой вопрос:
есть код где выодиться цена и тд.
public function newBet()
{
$data = $this->redis->lrange('bets.list', 0, -1);
foreach ($data as $newBetJson) {
$newBet = json_decode($newBetJson, true);
$user = User::find($newBet['userid']);
if (is_null($user)) continue;
if ($this->game->id < $newBet['gameid']) continue;
if ($this->game->id >= $newBet['gameid']) $newBet['gameid'] = $this->game->id;
if ($this->game->status == Game::STATUS_PRE_FINISH || $this->game->status == Game::STATUS_FINISHED) {
$this->_responseMessageToSite('Ваша ставка пойдёт на следующую игру.', $user->steamid64);
$this->redis->lrem('bets.list', 0, $newBetJson);
$newBet['gameid'] = $newBet['gameid'] + 1;
$this->redis->rpush('bets.list', json_encode($newBet));
continue;
}
$this->lastTicket = $this->redis->get('last.ticket.' . $this->game->id);
if (is_null($this->lastTicket)) $this->lastTicket = 0;
$ticketFrom = 1;
if($this->lastTicket != 0)
$ticketFrom = $this->lastTicket + 1;
$ticketTo = $ticketFrom + ($newBet['price'] * $this->config->TICKETS_RATE) - 1;
$this->redis->set('last.ticket.' . $this->game->id, $ticketTo);
$bet = new Bet();
$bet->user()->associate($user);
$bet->items = json_encode($newBet['items']);
$bet->itemsCount = count($newBet['items']);
$bet->price = $newBet['price'];
$bet->from = $ticketFrom;
$bet->to = $ticketTo;
$bet->game()->associate($this->game);
$bet->save();
$bets = Bet::where('game_id', $this->game->id);
$this->game->items = $bets->sum('itemsCount');
$this->game->price = $bets->sum('price');
if ($bet->price < '10') {
$color = "#ccc";
}
if (count($this->game->users()) >= $this->config->MIN_USERS || $this->game->items >= $this->config->MAX_ITEMSALL) {
$this->game->status = Game::STATUS_PLAYING;
$this->game->started_at = Carbon::now();
}
if ($this->game->items >= $this->config->MAX_ITEMSALL) {
$this->game->status = Game::STATUS_FINISHED;
$this->redis->publish(self::SHOW_WINNERS, true);
}
$this->game->save();
$chances = $this->_getChancesOfGame($this->game);
$returnValue = [
'betId' => $bet->id,
'userId' => $user->steam64,
'html' => view('includes.bet', compact('bet'))->render(),
'itemsCount' => $this->game->items,
'gamePriceHead' => $this->game->price,
'gameStatus' => $this->game->status,
'chances' => $chances
];
$this->redis->publish(self::NEW_BET_CHANNEL, json_encode($returnValue));
$this->redis->lrem('bets.list', 0, $newBetJson);
}
}
этот код отвечает за вывод суммы ставки юзера
$bet->price = $newBet['price'];
Вопрос в том как вывести это число в функцию которая в зависимости от суммы должна задавать цвет