Skip to content

Instantly share code, notes, and snippets.

@devmsh
Last active December 19, 2018 08:53
Show Gist options
  • Select an option

  • Save devmsh/87606421a126da2942343ec7a0b5784b to your computer and use it in GitHub Desktop.

Select an option

Save devmsh/87606421a126da2942343ec7a0b5784b to your computer and use it in GitHub Desktop.
User.php
<?php
class User{
public function addNewMobile($mobile): UserMobile
{
$userMobile = new UserMobile(['mobile' => $mobile, 'status' => self::STATUS_VERIFIED]);
if(app()->events->until(
event(new MobileVerifying($userMobile)) !== false
)){
$userMobile = $this->mobiles()->save($userMobile);
event(new MobileVerified($userMobile));
return $userMobile;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment