/** * Creates a new entity in the repository * * * @param array $data * @return bool */ public function create(array $data) { $userAddons = ['role' => User::USER_PLAYER, 'status' => User::USER_STATUS_ACTIVE]; $user = new User(array_merge($data, $userAddons)); $couldCreateUser = $user->save(); if ($couldCreateUser) { // create appropriate user based on roles $this->createForRole($user->role, $user->id); // send user sms $message = 'Your account has been successfully created on MediBig.com'; $user->sendSmsMessage($message, app('App\\MediBig\\Notifications\\SmsGateways\\SmsGatewayInterface')); // send user email $user->sendEmailMessage(app('App\\MediBig\\Notifications\\EmailGateways\\EmailGatewayInterface'), 'emails.welcome', 'Account Confirmation', ['first_name' => $data['first_name']]); } return $couldCreateUser; }