コード例 #1
0
 public function sendBookingEmails($booking)
 {
     $ehi_users = User::getEhiUsers();
     Mail::send('emails/transport-mail', array('booking' => Booking::find($booking->id)), function ($message) use($booking, $ehi_users) {
         $message->attach(public_path() . '/temp-files/transport.pdf')->subject('New Transfer : ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**');
         if (!empty($ehi_users)) {
             foreach ($ehi_users as $ehi_user) {
                 $message->to($ehi_user->email, $ehi_user->first_name);
             }
         }
     });
     /**
      * Excursions
      */
     if ($booking->excursion->count()) {
         Mail::send('emails/excursion-mail', array('booking' => $booking), function ($message) use($booking, $ehi_users) {
             $message->attach(public_path() . '/temp-files/excursions.pdf')->subject('New Excursions : ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel');
             $message->to('*****@*****.**', 'Excursions');
             $message->bcc('*****@*****.**', 'Admin');
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     /**
      * Hotel Vouchers
      */
     $vouchers = $booking->voucher;
     foreach ($vouchers as $voucher) {
         $hotel_users = DB::table('users')->leftJoin('hotel_user', 'users.id', '=', 'hotel_user.user_id')->where('hotel_user.hotel_id', $voucher->hotel_id)->get();
         Mail::send('emails/voucher-mail', array('voucher' => $voucher), function ($message) use($booking, $hotel_users, $voucher) {
             $message->attach(public_path() . '/temp-files/voucher' . $voucher->id . '.pdf')->subject('Booking Voucher : ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'SriLankaHotels.Travel');
             if (!empty($hotel_users)) {
                 foreach ($hotel_users as $hotel_user) {
                     $message->to($hotel_user->email, $hotel_user->first_name);
                 }
             }
         });
     }
     /**
      * Bookings
      */
     $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
     Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
         $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('New Booking: ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
         foreach ($emails as $emailaddress) {
             $message->to($emailaddress, 'Admin');
         }
         if (!empty($ehi_users)) {
             foreach ($ehi_users as $ehi_user) {
                 $message->to($ehi_user->email, $ehi_user->first_name);
             }
         }
     });
     /**
      * Invoice
      *
      *
      * Logged user
      */
     if ($user = $booking->user) {
         Mail::send('emails/invoice-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($user, $booking, $emails) {
             $message->subject('Booking Invoice : ' . $booking->reference_number)->attach(public_path() . '/temp-files/invoice' . $booking->id . '.pdf');
             $message->to($user->email, $user->first_name . ' ' . $user->last_name);
             $message->to('*****@*****.**', 'Accounts');
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     } else {
         /**
          * Invoice
          * Guest User
          */
         Mail::send('emails/invoice-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails) {
             $message->to($booking->email, $booking->name)->subject('Booking Created : ' . $booking->reference_number)->attach(public_path() . '/temp-files/invoice' . $booking->id . '.pdf');
             $message->to('*****@*****.**', 'Accounts');
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
 }
コード例 #2
0
 /**
  * Remove the specified client from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($bookingId, $id)
 {
     if (Client::destroy($id)) {
         $booking = Booking::getBookingData($bookingId);
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking (Client Removed): ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::back();
 }
コード例 #3
0
 /**
  * Update the specified excursionbooking in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($booking_id, $id)
 {
     $excursionbooking = ExcursionBooking::findOrFail($id);
     $booking = Booking::getBookingData($booking_id);
     if (Input::has('val')) {
         if (Input::get('val') == 0) {
             $excursionbooking->val = 0;
             $excursionbooking->save();
             $ehi_users = User::getEhiUsers();
             $pdf = PDF::loadView('emails/excursion-cancellation', array('booking' => $booking));
             $pdf->save(public_path() . '/temp-files/excursion-cancellations.pdf');
             Mail::send('emails/excursion-mail', array('booking' => Booking::find($booking->id)), function ($message) use($booking, $ehi_users) {
                 $message->attach(public_path() . '/temp-files/excursions.pdf')->subject('Cancel Excursion : ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel');
                 $message->to('*****@*****.**', 'Excursions');
                 $message->to('*****@*****.**', 'Admin');
                 if (!empty($ehi_users)) {
                     foreach ($ehi_users as $ehi_user) {
                         $message->to($ehi_user->email, $ehi_user->first_name);
                     }
                 }
             });
             // Cancellation email
             Invoice::amendInvoice($booking);
             Booking::amendBooking($booking_id);
             // Service Voucher
             $pdf = PDF::loadView('emails/service-voucher', array('booking' => $booking));
             $pdf->setPaper('a4')->save(public_path() . '/temp-files/service_voucher_' . $booking->id . '.pdf');
             $ehi_users = User::getEhiUsers();
             //$booking = Booking::getBookingData($booking->id);
             Mail::send('emails/service-voucher-mail', array('booking' => $booking), function ($message) use($booking, $ehi_users) {
                 $message->attach(public_path() . '/temp-files/service_voucher_' . $booking->id . '.pdf')->subject('Amended Service Voucher: ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
                 $message->to(Auth::user()->email, Auth::user()->first_name);
                 if (!empty($ehi_users)) {
                     foreach ($ehi_users as $ehi_user) {
                         $message->to($ehi_user->email, $ehi_user->first_name);
                     }
                 }
             });
             $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
             $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
             $pdf->save(public_path() . '/temp-files/booking_' . $booking->id . '.pdf');
             Mail::send('emails/booking-mail', array('booking' => $booking), function ($message) use($booking, $emails, $ehi_users) {
                 $message->attach(public_path() . '/temp-files/booking_' . $booking->id . '.pdf')->subject('Amended Booking: ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
                 //                foreach ($emails as $emailaddress) {
                 //                    $message->to($emailaddress, 'Admin');
                 //                }
                 if (!empty($ehi_users)) {
                     foreach ($ehi_users as $ehi_user) {
                         $message->to($ehi_user->email, $ehi_user->first_name);
                     }
                 }
             });
             $pdf = PDF::loadView('emails/invoice', array('booking' => $booking));
             $pdf->save(public_path() . '/temp-files/invoice_' . $booking->id . '.pdf');
             Mail::send('emails/invoice-mail', array('booking' => $booking), function ($message) use($booking, $emails, $ehi_users) {
                 $message->attach(public_path() . '/temp-files/invoice_' . $booking->id . '.pdf')->subject('Amended Invoice: ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
                 //                foreach ($emails as $emailaddress) {
                 //                    $message->bcc($emailaddress, 'SysAdmin');
                 //                }
                 if (!empty($ehi_users)) {
                     foreach ($ehi_users as $ehi_user) {
                         $message->to($ehi_user->email, $ehi_user->first_name);
                     }
                 }
             });
             return Redirect::back();
         }
     }
     $validator = Validator::make($data = Input::all(), ExcursionBooking::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $excursionbooking->update($data);
     return Redirect::back();
 }
コード例 #4
0
 /**
  * Remove the specified flightdetail from storage.
  *
  * @param  int $id
  * @return Response
  */
 public function destroy($bookingId, $id)
 {
     $user = Auth::user();
     Session::flash('bookings_show_tabs', 'flight-details-tab');
     if (FlightDetail::destroy($id)) {
         $booking = Booking::getBookingData($bookingId);
         $Currentbooking = Booking::first($bookingId);
         $Currentbooking->count = $Currentbooking->count++;
         $Currentbooking->save();
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Flight Info Deleted): ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::back();
 }