예제 #1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserRepositoryInterface $userRepository, BillingGateway $gateway, ShoppingCart $cart, AdminMailer $adminMailer, UserMailer $userMailer)
 {
     $data = ['name' => $this->name, 'email' => $this->email, 'phone' => $this->phone, 'city' => $this->city, 'country' => $this->country];
     $user = $userRepository->store($data);
     $chargeWasSuccessful = $gateway->charge($user, $cart->total(), $this->stripeToken);
     if ($chargeWasSuccessful) {
         $booking = $user->bookings()->create(['booking_reference' => $chargeWasSuccessful['response']['orderNumber'], 'status' => 'pending', 'comments' => '']);
         foreach ($cart->content() as $item) {
             $packageId = $item->options->package->id;
             $quantity = $item->qty;
             $child_quantity = $item->options->child_quantity;
             $booking->packages()->attach($packageId, ['adult_quantity' => $quantity, 'child_quantity' => $child_quantity, 'date' => $item->options->date, 'date_submit' => $item->options->date_submit]);
         }
         $cart->destroy();
         //fire off an email to send the booking reference to the customer.
         $userMailer->sendBookingConfirmation($user);
         //fire off an email to send the booking notification to admin
         $adminMailer->newCustomerBooking($user);
     } else {
         $userMailer->bookingWasNotSuccessful($user);
         /**
          * If payment is unsuccessful, delete the user to avoid duplicating his/her record on the "users" table
          */
         $userRepository->delete($user->id);
     }
 }
예제 #2
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(UserMailer $userMailer)
 {
     $user = new User();
     $user->first_name = $this->input['first_name'];
     $user->email = $this->input['email'];
     $user->password = $this->input['password'];
     $user->confirmation_token = str_random(30);
     $user->save();
     $userMailer->setupConfirmationEmail($user)->send();
     // add to mailing list
     // $this->mailingList->add($user);
     // think about firing an event
     // event(new UserRegistered($user));
 }
 /**
  * Handle the event.
  *
  * @param  UserRegistered $event
  * @return void
  */
 public function handle(UserRegistered $event)
 {
     $this->mailer->sendWelcomeMessageTo($event->user);
 }
예제 #4
0
 /**
  * Handle the event.
  *
  * @param FriendRequestWasSent $event
  * @return void
  */
 public function handle(FriendRequestWasSent $event)
 {
     $this->mailer->sendFriendRequestAlertTo($event->requestedUser, $event->requesterUser);
 }
 /**
  * Handle the event.
  *
  * @param  UserForgotPassword  $event
  * @return void
  */
 public function handle(UserForgotPassword $event)
 {
     $this->userMailer->sendPasswordResetRequest($event->user, $event->token);
 }
 /**
  * Handle the event.
  *
  * @param  UserWasSignedUp  $event
  * @return void
  */
 public function handle(UserWasSignedUp $event)
 {
     $this->userMailer->sendSignupConfirmation($event->user);
 }