Multi-db fixes

This commit is contained in:
Hillel Coren 2017-05-10 13:02:20 +03:00
parent 0a847a338d
commit 44e477a9e1
6 changed files with 23 additions and 13 deletions

View File

@ -182,7 +182,7 @@ class UserController extends BaseController
->withInput(); ->withInput();
} }
if (! \App\Models\LookupUser::validateEmail($email, $user)) { if (! \App\Models\LookupUser::validateEmail(Input::get('email'), $user)) {
return Redirect::to($userPublicId ? 'users/edit' : 'users/create') return Redirect::to($userPublicId ? 'users/edit' : 'users/create')
->withError(trans('texts.email_taken')) ->withError(trans('texts.email_taken'))
->withInput(); ->withInput();

View File

@ -50,7 +50,9 @@ AccountToken::creating(function ($token)
AccountToken::deleted(function ($token) AccountToken::deleted(function ($token)
{ {
if ($token->forceDeleting) {
LookupAccountToken::deleteWhere([ LookupAccountToken::deleteWhere([
'token' => $token->token 'token' => $token->token
]); ]);
}
}); });

View File

@ -176,7 +176,9 @@ Contact::creating(function ($contact)
Contact::deleted(function ($contact) Contact::deleted(function ($contact)
{ {
if ($contact->forceDeleting) {
LookupContact::deleteWhere([ LookupContact::deleteWhere([
'contact_key' => $contact->contact_key, 'contact_key' => $contact->contact_key,
]); ]);
}
}); });

View File

@ -173,7 +173,9 @@ Invitation::creating(function ($invitation)
Invitation::deleted(function ($invitation) Invitation::deleted(function ($invitation)
{ {
if ($invitation->forceDeleting) {
LookupInvitation::deleteWhere([ LookupInvitation::deleteWhere([
'invitation_key' => $invitation->invitation_key, 'invitation_key' => $invitation->invitation_key,
]); ]);
}
}); });

View File

@ -17,6 +17,7 @@ class LookupUser extends LookupModel
'lookup_account_id', 'lookup_account_id',
'email', 'email',
'user_id', 'user_id',
'confirmation_code',
]; ];
public static function updateUser($accountKey, $userId, $email, $confirmationCode) public static function updateUser($accountKey, $userId, $email, $confirmationCode)

View File

@ -418,6 +418,7 @@ User::created(function ($user)
LookupUser::createNew($user->account->account_key, [ LookupUser::createNew($user->account->account_key, [
'email' => $user->email, 'email' => $user->email,
'user_id' => $user->id, 'user_id' => $user->id,
'confirmation_code' => $user->confirmation_code,
]); ]);
}); });
@ -440,7 +441,9 @@ User::deleted(function ($user)
return; return;
} }
if ($user->forceDeleting) {
LookupUser::deleteWhere([ LookupUser::deleteWhere([
'email' => $user->email 'email' => $user->email
]); ]);
}
}); });