public function updateBalance() { $historyModel = new BalanceHistory(); $balance = $historyModel->getBalanceById($this->user->id); $this->balance = $balance; $this->save(false, ['balance']); }
public function crib() { $balanceModel = new BalanceHistory(); $balanceModel->id = md5($this->id . '' . time()); $balanceModel->type = BalanceHistory::TYPE_REMOVE; $balanceModel->userId = $this->id; $balanceModel->sum = $this->crib; $balanceModel->date = date(DATE_FORMAT_DB); $balanceModel->save(); $balance = $balanceModel->getBalanceById($this->id); $this->profile->updateBalance(); }