PHP User::getEhiUsers Examples

PHP User::getEhiUsers - 4 examples found. These are the top rated real world PHP examples of User::getEhiUsers extracted from open source projects. You can rate examples to help us improve the quality of examples.
 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('transport@srilankahotels.travel', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel');
         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('noreply@srilankahotels.travel', 'SriLankaHotels.Travel');
             $message->to('excursions@srilankahotels.travel', 'Excursions');
             $message->bcc('admin@srilankahotels.travel', '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('reservations@srilankahotels.travel', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', 'SriLankaHotels.Travel');
             if (!empty($hotel_users)) {
                 foreach ($hotel_users as $hotel_user) {
                     $message->to($hotel_user->email, $hotel_user->first_name);
                 }
             }
         });
     }
     /**
      * Bookings
      */
     $emails = array('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
     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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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@srilankahotels.travel', '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@srilankahotels.travel', 'Accounts');
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
 }
 /**
  * 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('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
         $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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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();
 }
 /**
  * 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('noreply@srilankahotels.travel', 'SriLankaHotels.Travel');
                 $message->to('excursions@srilankahotels.travel', 'Excursions');
                 $message->to('admin@srilankahotels.travel', '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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
             $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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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();
 }
 /**
  * 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('tharinda@exotic-intl.com', 'lahiru@exotic-intl.com', 'umesh@exotic-intl.com');
         $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('noreply@srilankahotels.com', 'SriLankaHotels.Travel')->bcc('admin@srilankahotels.travel', '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();
 }