$id, 'frozen_amount' => DB::raw('frozen_amount + '. $amount), 'available_amount' => DB::raw('available_amount - '. $amount), ]; return $this->updateItem($updateItem); } function unFrozenAmount($id,$amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'frozen_amount' => DB::raw('frozen_amount - '. $amount), 'available_amount' => DB::raw('available_amount + '. $amount), ]; return $this->updateItem($updateItem); } function subFrozenAmount($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount - '. $amount), 'frozen_amount' => DB::raw('frozen_amount - '. $amount), ]; return $this->updateItem($updateItem); } function addFrozenAmount($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount + '. $amount), 'frozen_amount' => DB::raw('frozen_amount + '. $amount), ]; return $this->updateItem($updateItem); } function subAvailableAmount($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount - '. $amount), 'available_amount' => DB::raw('available_amount - '. $amount), ]; return $this->updateItem($updateItem); } function addAvailableAmount($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount + '. $amount), 'available_amount' => DB::raw('available_amount + '. $amount), ]; return $this->updateItem($updateItem); } function balanceToSecurity($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount - '. $amount), 'available_amount' => DB::raw('available_amount - '. $amount), 'security_amount' => DB::raw('security_amount + '. $amount), ]; return $this->updateItem($updateItem); } function securityToBalance($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'total_amount' => DB::raw('total_amount + '. $amount), 'available_amount' => DB::raw('available_amount + '. $amount), 'security_amount' => DB::raw('security_amount - '. $amount), ]; return $this->updateItem($updateItem); } function subSecurityAmount($id, $amount): bool|int { $amount = abs($amount); $updateItem = [ 'id' => $id, 'security_amount' => DB::raw('security_amount - '. $amount), ]; return $this->updateItem($updateItem); } function findByUidCurrencyCode($uid, $currency_code): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Builder|array|null { return $this->findItemByWhere(['uid' => $uid, 'currency_code' => $currency_code]); } }