Skip to content

Instantly share code, notes, and snippets.

@devmsh
Last active December 18, 2018 12:21
Show Gist options
  • Select an option

  • Save devmsh/85f509ffdfa396b35a4434041b252a29 to your computer and use it in GitHub Desktop.

Select an option

Save devmsh/85f509ffdfa396b35a4434041b252a29 to your computer and use it in GitHub Desktop.
User.php
<?php
class User {
public function addNewMobile($mobile): UserMobile
{
User::where('mobile', $mobile)->where('status',self::STATUS_NOT_VERIFIED)->delete();
$this->activationCodes()->where('mobile', $mobile)->delete();
$userMobile = $this->mobiles()->create(['mobile' => $mobile, 'status' => self::STATUS_VERIFIED]);
Invitation::deleteInvalidInvitation($mobile);
if (AdminSetting::getSetting('check_invitation_notification')) {
$userMobile->user->notify(new CheckInvitationsNotification());
}
return $userMobile;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment