public function transferAccounts(TXO $model, Account $from, Account $to, $allowed_types = null) { if ($allowed_types === null) { $allowed_types = [TXO::UNCONFIRMED, TXO::CONFIRMED]; } return $model->where('id', '=', $model['id'])->where('account_id', '=', $from['id'])->whereIn('type', $allowed_types)->update(['account_id' => $to['id']]); }