public function _saveBalance($type)
	{
		if ($type == 'creation')
		{
			$model = Account::blank();
		}
		else
		{
			$model = Account::oneByUserId($this->uid);
		}

		$model->set([
			'uid'      => $this->uid,
			'balance'  => $this->balance,
			'earnings' => $this->earnings,
			'credit'   => $this->credit
		]);

		if (!$model->save())
		{
			$this->setError($model->getError());

			return false;
		}

		return true;
	}
public function _saveBalance($type)
	{
		if ($type == 'creation')
		{
			$model = Account::blank();
		}
		else
		{
			$model = Account::oneByUserId($this->uid);
		}

		$model->set([
			'uid'      => $this->uid,
			'balance'  => $this->balance,
			'earnings' => $this->earnings,
			'credit'   => $this->credit
		]);

		if (!$model->save())
		{
			$this->setError($model->getError());

			return false;
		}

		return true;
	}
public function _saveBalance ( $ type ) { if ( $ type == 'creation' ) { $ model = Account :: blank ( ) ; } else { $ model = Account :: oneByUserId ( $ this -> uid ) ; } $ model -> set ( [ 'uid' => $ this -> uid , 'balance' => $ this -> balance , 'earnings' => $ this -> earnings , 'credit' => $ this -> credit ] ) ; if ( ! $ model -> save ( ) ) { $ this -> setError ( $ model -> getError ( ) ) ; return false ; } return true ; }
Save the current balance

@param   string   $type  Record type (inserting or updating)
@return  boolean  True on success
Save the current balance