/** * Updates an existing EventEntry model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($ee_id) { $eventEntryModel = $this->findModel($ee_id); $eventModel = Event::findOne($eventEntryModel->event->id); $bookingModel = new Booking(); $bookingModel->attributes = array_merge($eventEntryModel->attributes, $eventModel->attributes); if ($bookingModel->load(Yii::$app->request->post()) && $eventEntryModel->save()) { return $this->redirect(['view', 'id' => $eventEntryModel->id]); } else { return $this->render('update', ['eventEntryModel' => $eventEntryModel]); } }
/** * Store a newly created resource in storage. * * @return Response */ public function store($id) { $listing = Listing::where('isPublic', '=', 1)->where('id', '=', $id)->first(); if (!$listing) { throw new \Symfony\Component\Routing\Exception\ResourceNotFoundException(); } $input = Input::all(); //return print_r($input,true); $yesterday = \Carbon\Carbon::now('Australia/Sydney'); $yesterday = $yesterday->format('Y-m-d H:i:s'); // return $yesterday; $rules = array('comments' => array('required', 'min:3'), 'user_phone' => array('required', 'min:9', 'max:30'), 'request_start_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'before: ' . $input['request_end_datetime']), 'request_end_datetime' => array('required', 'date', 'dateformat: Y-m-d H:i:s', 'after: ' . $yesterday)); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::back()->withInput($input)->withErrors($validator); } $comments = $this->sanitizeStringAndParseMarkdown($input['comments']); $authuser = Auth::user(); $name = $authuser->name; $bookings = new Booking(); $bookings->user_id = $authuser->id; $bookings->user_name = $name; $bookings->listing_id = $id; $bookings->user_phone = $input['user_phone']; $bookings->request_start_datetime = $input['request_start_datetime']; $bookings->request_end_datetime = $input['request_end_datetime']; $bookings->status = "Booking request submitted. Awaiting Open Source Collaborative Consumption Marketplace review."; $bookings->user_comments = $comments; $bookings->space_owner_id = $listing->owner_id; $address = $listing->address1 . ", " . $listing->suburb . ", " . $listing->city . " " . $listing->country; $data = $input; $data['address'] = $address; $data['title'] = $listing->title; $data['id'] = $id; $data['type'] = $listing->space_type; $data['user_name'] = $name; $data['status'] = $bookings->status; /* TODO: Make it email the user and space owner */ Mail::send("booking.mail.newbookingfounders", $data, function ($message) { $message->to('*****@*****.**')->subject('New booking on Open Source Collaborative Consumption Marketplace'); }); $email = Auth::user()->email; Mail::send("booking.mail.newbookinguser", $data, function ($message) use($email) { $message->to($email)->subject('Your new booking on Open Source Collaborative Consumption Marketplace!'); }); $bookings->save(); return Redirect::to('dashboard')->with('flash_message_good', "Your booking has been sent. We'll be in touch soon with confirmation or questions!"); }
public function register($leadership_event_id, $booking_id) { $input = Input::all(); $validator = Validator::make($input, Booking::$rules); if ($validator->passes()) { $booking = Booking::findOrFail($booking_id); $booking->registration_date = new Datetime(); $booking->first = Input::get('first'); $booking->last = Input::get('last'); $booking->email = Input::get('email'); $booking->contact_number = Input::get('contact_number'); $booking->church = Input::get('church'); $booking->role = Input::get('role'); $booking->notes = Input::get('notes'); $booking->save(); return Redirect::route('registration', array($leadership_event_id))->with('info', 'Registration complete!'); } else { $event = LeadershipEvent::find($leadership_event_id); $bookings = Booking::where('id', $booking_id)->get(); $bookings->each(function ($booking) { // Should actually only be one... $booking->first = Input::get('first'); $booking->last = Input::get('last'); $booking->email = Input::get('email'); $booking->contact_number = Input::get('contact_number'); $booking->church = Input::get('church'); $booking->role = Input::get('role'); $booking->notes = Input::get('notes'); }); $this->layout->with('subtitle', $event->name()); $this->layout->withErrors($validator); $this->layout->content = View::make('registration.index')->with('event', $event)->with('bookings', $bookings)->with('errors', $validator->messages()); } }
public function unregister($leadership_event_id, $id) { $booking = Booking::findOrFail($id); $booking->registration_date = null; $booking->save(); return Redirect::route('booking.show', array($leadership_event_id, $id))->with('info', 'Unregistered booking!'); }
public function destroy($kitTypeID) { // This Shall be fun! // We have to deconstruct the types based on the forign key dependencys // First iterate all the kits, for each kit remove all contents, // and then all bookings (and all booking details) // then finally we can remove the kit type and then all the logs for that // kit type. foreach (Kits::where('KitType', '=', $kitTypeID)->get() as $kit) { foreach (KitContents::where("KitID", '=', $kit->ID)->get() as $content) { KitContents::destroy($content->ID); } foreach (Booking::where("KitID", '=', $kit->ID)->get() as $booking) { foreach (BookingDetails::where("BookingID", '=', $booking->ID)->get() as $detail) { BookingDetails::destroy($detail->ID); } Booking::destroy($booking->ID); } Kits::destroy($kit->ID); } KitTypes::destroy($kitTypeID); // Do the logs last, as all the deletes will log the changes of deleting the bits. Logs::where('LogKey1', '=', $kitTypeID)->delete(); return "OK"; }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Booking::create([]); } }
public function stageEnterCredentials() { $valid = true; $booking = new BookingForm(); if (isset($_POST['BookingForm'])) { $booking->attributes = $_POST['BookingForm']; $valid = $booking->validate() && $valid; } else { $valid = false; } $passport = new AviaPassportForm(); if (isset($_POST['PassportForm'])) { $passport->attributes = $_POST['PassportForm']; $valid = $valid && $passport->validate(); } if ($valid) { //saving data to objects $bookingAr = new Booking(); $bookingAr->email = $booking->contactEmail; $bookingAr->phone = $booking->contactPhone; if (!Yii::app()->user->isGuest) { $bookingAr->userId = Yii::app()->user->id; } $bookingPassports = array(); $bookingPassport = new BookingPassport(); $bookingPassport->birthday = $passport->birthday; $bookingPassport->firstName = $passport->firstName; $bookingPassport->lastName = $passport->lastName; $bookingPassport->countryId = $passport->countryId; $bookingPassport->number = $passport->number; $bookingPassport->series = $passport->series; $bookingPassport->genderId = $passport->genderId; $bookingPassport->documentTypeId = $passport->documentTypeId; $bookingPassports[] = $bookingPassport; $bookingAr->bookingPassports = $bookingPassports; $bookingAr->flightId = Yii::app()->flightBooker->current->flightVoyage->flightKey; if ($bookingAr->save()) { Yii::app()->flightBooker->current->bookingId = $bookingAr->id; Yii::app()->flightBooker->status('booking'); $this->refresh(); } else { $this->render('enterCredentials', array('passport' => $passport, 'booking' => $booking)); } } else { $this->render('enterCredentials', array('passport' => $passport, 'booking' => $booking)); } }
/** * Creates a registration record for a booking. */ public function register_booking() { $booking_id = Input::get('booking_id'); $tickets = Input::get('tickets'); $booking = Booking::findOrFail($booking_id); $booking->registrations()->save(new Registration(array('tickets' => $tickets))); return Redirect::route('register')->withInput()->with('info', 'Registration complete!'); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Booking the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Booking::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function totalCreditFromAllBookings() { $bookings = Booking::where('user_id', Auth::id())->get(); $total = 0; foreach ($bookings as $booking) { $total += Booking::getTotalBookingAmount($booking); } return $total; }
public function deleteBooking() { if (!Request::ajax()) { return "not a json request"; } $post = Input::all(); BookingDetails::where('BookingID', '=', $post['BookID'])->delete(); Booking::destroy($post['BookID']); return Response::json(array('success' => true), 200); }
public function postManage() { $booking = Booking::find(Input::get('id')); if ($booking) { $booking->status = Input::get('status'); $booking->save(); return Redirect::to('bookings/manage')->with('message', 'Booking Updated'); } return Redirect::back()->with('message', 'Something went wrong, please try again'); }
public function executeCreateBooking(sfWebRequest $request) { if ($this->getUser()->isAuthenticated()) { $app = Doctrine_Core::getTable('Apartment')->find($request->getPostParameter('apid')); $date_from = $request->getPostParameter('date_from'); $date_to = $request->getPostParameter('date_to'); $pax = $request->getPostParameter('pax'); $booking = new Booking(); $booking->Apartment = $app; $booking->pax = $pax; $booking->date_from = $date_from; $booking->date_to = $date_to; $booking->DoBooking($this->getUser()->getGuardUser()); $this->success = true; } else { return sfView::NONE; /* Log this !*/ } }
public function update(Request $request, $id) { $booking = Booking::where('id', $id)->first(); $booking->arrive_date = $request->input('arrive_date'); $booking->leave_date = $request->input('leave_date'); $booking->personal_ids = $request->input('personal_ids'); $booking->room_id = $request->input('room_id'); $booking->save(); return $booking; }
function cancelAction() { $user = \bootstrap::getInstance()->getUser(); if (!$user['id']) { return $this->_redirect('/'); } $db = \Zend_Registry::get('db'); $newValues = array('canceled' => 1); $condition = 'id=' . (int) $this->params('id'); $appointment_date = $db->select()->from('appointments', array('date'))->where('id=?', $this->params('id'))->query()->fetchColumn(); if ($user['type'] == 'client') { $booking = new Booking(array('today' => date('Y-m-d'), 'date' => $appointment_date)); if (!$booking->allowCancelByUser()) { echo 'not allowed to cancel'; exit; } $condition .= ' && user_id = ' . (int) $user['id']; } else { if ($user['type'] == 'staff') { $condition .= ' && staff_userid = ' . (int) $user['id']; } else { if ($user['type'] !== 'admin') { return $this->_redirect('/'); } } } $db->update('appointments', $newValues, $condition); $logMessage = 'Therapist appointment #' . (int) $this->params('id'); $logMessage .= ' cancelled by user #' . $user['id']; $this->cancelsLogger()->log($logMessage, Zend_Log::INFO); $this->viewParams['date'] = $appointment_date; $viewModel = new ViewModel($this->viewParams); $viewModel->setTemplate('appointments/cancel.phtml'); $htmlOutput = $this->getServiceLocator()->get('viewrenderer')->render($viewModel); $mail = new Zend_Mail(); $mail->addTo($user['email']); $mail->setBodyText($htmlOutput); $this->queueMail($mail); echo $htmlOutput; $this->_helper->viewRenderer->setNoRender(true); }
public function actionBookingform($isFancy = 0) { Yii::app()->getModule('apartments'); $this->modelName = 'Apartment'; $apartment = $this->loadModel(); $this->modelName = 'Booking'; $booking = new Booking(); $booking->scenario = 'bookingform'; if (isset($_POST['Booking']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong) && !$apartment->deleted) { $booking->attributes = $_POST['Booking']; $booking->apartment_id = $apartment->id; $booking->user_ip = Yii::app()->controller->currentUserIp; $booking->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong; if ($booking->validate()) { $booking->time_inVal = $this->getI18nTimeIn($booking->time_in); $booking->time_outVal = $this->getI18nTimeOut($booking->time_out); if (issetModule('bookingtable')) { Bookingtable::addRecord($booking); } $types = Apartment::getI18nTypesArray(); $booking->type = $types[Apartment::TYPE_RENT]; $ownerApartment = User::model()->findByPk($apartment->owner_id); $booking->ownerEmail = $ownerApartment->email; $notifier = new Notifier(); $notifier->raiseEvent('onNewBooking', $booking, array('user' => $ownerApartment)); Yii::app()->user->setFlash('success', tt('Operation successfully complete. Your order will be reviewed by owner.')); $this->redirect($apartment->getUrl()); } } $user = null; if (!Yii::app()->user->isGuest) { $user = User::model()->findByPk(Yii::app()->user->getId()); } if ($isFancy) { $this->excludeJs(); $this->renderPartial('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => true, 'user' => $user), false, true); } else { $this->render('bookingform', array('apartment' => $apartment, 'model' => $booking, 'isFancy' => false, 'user' => $user)); } }
public function myDateValidator($param) { $dateStart = CDateTimeParser::parse($this->date_start, Booking::getYiiDateFormat()); // format to unix timestamp $dateEnd = CDateTimeParser::parse($this->date_end, Booking::getYiiDateFormat()); // format to unix timestamp if ($param == 'date_start' && $dateStart < CDateTimeParser::parse(date('Y-m-d'), 'yyyy-MM-dd')) { $this->addError('date_start', tt('Wrong check-in date', 'booking')); } if ($param == 'date_end' && $dateEnd <= $dateStart) { $this->addError('date_end', tt('Wrong check-out date', 'booking')); } }
public function index() { self::authorize_user(); $bookings = Booking::all(); $doctors = User::doctors(); $polyclinics = Polyclinic::all(); $patients = User::patients(); $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null; $doctor_id = isset($_REQUEST['doctor_id']) ? $_REQUEST['doctor_id'] : null; $polyclinic_id = isset($_REQUEST['polyclinic_id']) ? $_REQUEST['polyclinic_id'] : null; $patient_id = isset($_REQUEST['patient_id']) ? $_REQUEST['patient_id'] : null; // La funcion render esta declarada en la clase padre ApplicationController. require 'app/views/reports/report.php'; }
public function index() { $this->layout->with('subtitle', 'Bookings'); $bookings = Booking::orderBy('last')->orderBy('first'); $filtered = false; $filter_name = Session::get('bookings_filter_name', ''); $filter_church = Session::get('bookings_filter_church', ''); $filter_eventbrite = Session::get('bookings_filter_eventbrite', ''); $filter_registered = Session::get('bookings_filter_registered', ''); $filter_not_registered = Session::get('bookings_filter_not_registered', ''); $filter_saturday = Session::get('bookings_filter_saturday', ''); $filter_not_saturday = Session::get('bookings_filter_not_saturday', ''); if (!empty($filter_name)) { $bookings = $bookings->where(function ($query) use($filter_name) { $query->where('bookings.first', 'LIKE', "%{$filter_name}%")->orWhere('bookings.last', 'LIKE', "%{$filter_name}%"); }); $filtered = true; } if (!empty($filter_church)) { $bookings = $bookings->where('source', 'Church'); $filtered = true; } if (!empty($filter_eventbrite)) { $bookings = $bookings->where('source', 'EventBrite'); $filtered = true; } if (($filter_registered || $filter_not_registered) && !($filter_registered && $filter_not_registered)) { if ($filter_registered) { $ids = DB::table('booking_registration_counts')->whereRaw('tickets <= registrations')->lists('id'); if ($ids) { $bookings = $bookings->whereIn('id', $ids); } } else { $ids = DB::table('booking_registration_counts')->whereRaw('tickets > registrations')->lists('id'); if ($ids) { $bookings = $bookings->whereIn('id', $ids); } } } if (($filter_saturday || $filter_not_saturday) && !($filter_saturday && $filter_not_saturday)) { if ($filter_saturday) { $bookings = $bookings->where('saturday', true); } else { $bookings = $bookings->where('saturday', false); } $filtered = true; } $bookings = $bookings->paginate(25); $this->layout->content = View::make('bookings.index')->with('bookings', $bookings)->with('filtered', $filtered)->with('filter_name', $filter_name)->with('filter_church', $filter_church)->with('filter_eventbrite', $filter_eventbrite)->with('filter_registered', $filter_registered)->with('filter_not_registered', $filter_not_registered)->with('filter_saturday', $filter_saturday)->with('filter_not_saturday', $filter_not_saturday); }
public static function amendInvoice($booking) { $total = Booking::getTotalBookingAmount($booking); $invoice = Invoice::where('booking_id', $booking->id)->first(); if ($invoice) { $invoice->count = ++$invoice->count; $invoice->amount = $total; $invoice->save(); return true; } else { $invoiceData = array('amount' => $total, 'booking_id' => $booking->id); Invoice::create($invoiceData); return false; } }
public function view() { /* $user = Auth::user(); $personal_bookings = Booking::where('user_id', '=', $user->id); $bookings_of_my_spaces = Booking::where('space_owner_id', '=', $user->id); $my_spaces = Listing::where('owner_id', '=', $user->id)->get(array('title', 'id')); */ $userid = Auth::user()->id; $user = User::findOrFail($userid); $personal_bookings = $user->booking; $bookings_of_my_spaces = Booking::where('space_owner_id', '=', $userid)->get(); // $bookings_of_my_spaces = $user->bookings_by_others; $my_spaces = $user->listing; return View::make('dashboard.DashboardView')->with('name', $user->name)->with('email', $user->email)->with('personal_bookings', $personal_bookings)->with('bookings_of_my_spaces', $bookings_of_my_spaces)->with('my_spaces', $my_spaces); }
public function thankyou($payment_reference = null, $charge = null) { $charge = Session::get('charge'); $payment_reference = Session::get('payment_reference'); if ($payment_reference) { $booking = Booking::find($payment_reference); $booking->receipt = array('stripe_id' => $charge->id, 'payment_reference' => Session::get('payment_reference'), 'amount' => $charge->amount); $booking->save(); Tour::where('dates.id', (int) $booking->tour_date)->decrement('dates.$.spaces'); $tour = Tour::find($booking->id); Mail::send('emails.stripebooking', compact('booking', 'tour'), function ($message) { $message->to('*****@*****.**', 'Not Normal Tours')->subject('New Booking at Not Normal Tours'); }); return View::make('pages.thankyou'); } return View::make('pages.thankyou'); }
protected function processForm(sfWebRequest $request, sfForm $form) { $form->bind($request->getParameter($form->getName())); $params = $request->getParameter($this->form->getName()); if ($form->isValid()) { // $notice = $form->getObject()->isNew() ? 'Booking was created successfully.' : 'Booking was updated successfully.'; try { /* Start booking */ $apartment = Doctrine_Core::getTable('Apartment')->find($params['apartment_id']); $booking = $form->getObject(); $from = $params['date_from']['year'] . '-' . $params['date_from']['month'] . '-' . $params['date_from']['day']; $to = $params['date_to']['year'] . '-' . $params['date_to']['month'] . '-' . $params['date_to']['day']; $booking->date_from = $from; $booking->date_to = $to; if ($booking->StartBooking($apartment, $params['pax'])) { $booking->Apartment = $apartment; $booking->client_id = $params['client_id']; $booking->pax = $params['pax']; $booking->valid = $params['valid']; $booking->canceled = $params['canceled']; $booking->price = Booking::CalculatePrice($apartment, $from, $to); $booking->save(); // return sfView::SUCCESS; $this->redirect(array('sf_route' => 'booking_edit', 'sf_subject' => $booking)); $this->getUser()->setFlash('error', ' Booking successfully created. ', false); } else { $this->getUser()->setFlash('error', 'Apartment is unavalible for this dates !', false); return sfView::SUCCESS; } } catch (Doctrine_Validator_Exception $e) { $errorStack = $form->getObject()->getErrorStack(); $message = get_class($form->getObject()) . ' has ' . count($errorStack) . " field" . (count($errorStack) > 1 ? 's' : null) . " with validation errors: "; foreach ($errorStack as $field => $errors) { $message .= "{$field} (" . implode(", ", $errors) . "), "; } $message = trim($message, ', '); $this->getUser()->setFlash('error', $message); return sfView::SUCCESS; } $this->dispatcher->notify(new sfEvent($this, 'admin.save_object', array('object' => $booking))); } else { $this->getUser()->setFlash('error', 'There are some errors ...', false); } }
public function actionExport() { $re = Booking::model()->findAll(); //echo "<pre>";print_r($re); foreach ($re as $res) { $detail = $res['cleaningDetail']; $trans = $res['trans_id']; $price = $res['price']; $serName = $res->serviceType['service_name']; $cAdd = $res->customerAddress['address']; $company = $res->service['company_name']; $val[] = array('Copmany Name' => $company, 'Customer Address' => $cAdd, 'Service Name' => $serName, 'price' => $price, 'TransId' => $trans, 'Detail' => $detail); } //echo "<pre>";print_r($val);die; $filename = "payment.csv"; $csv = new ECSVExport($val); $content = $csv->toCSV(); Yii::app()->getRequest()->sendFile($filename, $content, "text/csv", false); exit; }
public function CheckBookingPossibility(Apartment $app, $pax) { /* Avalibility check. Expecting TRUE or FALSE */ $avalibility = $app->CheckBookingsInPeriod($this->date_from, $this->date_to); /* Are dates valid for individual apartment ? */ $dates = true; /* Minimum or maximum pax for individual apartment or ... ? */ $pax_valid = false; if ($pax >= 1 && $pax <= $app->getMaxPax()) { $pax_valid = true; } /* Are there periods for dates... Can we get real price ? */ $price = false; if (Booking::CalculatePrice($app, $this->date_from, $this->date_to) > 0) { $price = true; } if ($dates === true && $avalibility === false && $pax_valid === true && $price === true) { return $this; } else { return false; } }
* This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ /** * View "meldeschein" as RTF * * Calendar * * @since 2004-06-05 * @author Christian Ehret <*****@*****.**> */ $nocachecontrol = true; include_once "../includes/default.inc.php"; $auth->is_authenticated(); include_once '../includes/bookingclass.inc.php'; include_once "../includes/fileselector.inc.php"; $booking = new Booking(); $bookid = $request->GetVar('bookid', 'get'); $bookdata = $booking->getMeldedata($bookid); // get RTF-Template $tplfile = selectfile('tpl_meldeschein.rtf'); // $tplfile = 'C:\wwwroot\zvs\default\tpl_meldeschein.rtf'; $tplHandle = fopen($tplfile, 'r'); $tpl = fread($tplHandle, filesize($tplfile)); fclose($tplHandle); // replace placeholders $tpl = ereg_replace("%arrival%", $bookdata[nicestart], $tpl); $tpl = ereg_replace("%depature%", $bookdata[niceend], $tpl); $tpl = ereg_replace("%name1%", $bookdata[lastname], $tpl); $tpl = ereg_replace("%firstname1%", $bookdata[firstname], $tpl); $birthday = ""; if ($bookdata[birthdate] !== "00.00.0000") {
echo smartyTranslate(array('s' => 'None'), $_smarty_tpl); } ?> </td> <?php if ($_smarty_tpl->getVariable('cookie')->value->RoleID == 1) { ?> <td>¥ <?php echo number_format($_smarty_tpl->tpl_vars['roomplan']->value['MinPrice'], 0, ".", ", "); ?> </td> <?php } else { ?> <td>¥ <?php echo number_format(Booking::shoushuliao($_smarty_tpl->tpl_vars['roomplan']->value['MinPrice'], $_smarty_tpl->tpl_vars['roomplan']->value['RoomPlanId']), 0, ".", ", "); ?> </td> <?php } ?> </tr> <?php } } ?> <!-- <tr> <td><input type="checkbox" /></td> <td><img src="<?php echo $_smarty_tpl->getVariable('img_dir')->value;
private function createBooking(BookingType $bookingType, $label, $value) { $booking = new Booking(); return $booking->setBookingType($bookingType)->setLabel($label)->setValue($value); }
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); } } }); } }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); // $this->call('UserTableSeeder'); DB::table('bookings')->delete(); DB::table('registrations')->delete(); // Church bookings Booking::create(array('first' => 'Spencer', 'last' => 'Kaur', 'tickets' => 1, 'source' => 'Church', 'numbers' => '1')); Booking::create(array('first' => 'Molly', 'last' => 'Sharpe', 'tickets' => 2, 'source' => 'Church', 'numbers' => '2,3')); Booking::create(array('first' => 'Zara', 'last' => 'Sharp', 'tickets' => 4, 'source' => 'Church', 'numbers' => '32,34,36,38')); Booking::create(array('first' => 'Archie', 'last' => 'Field', 'tickets' => 8, 'source' => 'Church', 'numbers' => '32,33,34,35,36,37,38,39')); Booking::create(array('first' => 'Charles', 'last' => 'Dennis', 'tickets' => 12, 'source' => 'Church', 'numbers' => '132,133,134,135,136,137,138,139,140,141,142')); Booking::create(array('first' => 'Jack', 'last' => 'Ryan', 'tickets' => 1, 'source' => 'Church', 'numbers' => '501')); Booking::create(array('first' => 'Charlotte', 'last' => 'Crawford', 'tickets' => 2, 'source' => 'Church', 'numbers' => '503,504')); Booking::create(array('first' => 'Rebecca', 'last' => 'Atkinson', 'tickets' => 2, 'source' => 'Church', 'numbers' => '505,506')); Booking::create(array('first' => 'Lara', 'last' => 'Douglas', 'tickets' => 2, 'source' => 'Church', 'numbers' => '602,605')); Booking::create(array('first' => 'Harriet', 'last' => 'Tucker', 'tickets' => 1, 'source' => 'Church')); Booking::create(array('first' => 'Lilly', 'last' => 'Charlton', 'tickets' => 1, 'source' => 'Church')); Booking::create(array('first' => 'Logan', 'last' => 'Clements', 'tickets' => 2, 'source' => 'Church')); $booking = Booking::create(array('first' => 'Evie', 'last' => 'Pritchard', 'tickets' => 1, 'source' => 'Church')); $booking->registrations()->save(new Registration(array('tickets' => 2))); $booking = Booking::create(array('first' => 'Lara', 'last' => 'Armstrong', 'tickets' => 2, 'source' => 'Church')); $booking->registrations()->save(new Registration(array('tickets' => 2))); $booking = Booking::create(array('first' => 'Charlie', 'last' => 'Slater', 'tickets' => 6, 'source' => 'Church')); $booking->registrations()->save(new Registration(array('tickets' => 2))); $booking = Booking::create(array('first' => 'Rachel', 'last' => 'Whittaker', 'tickets' => 1, 'source' => 'Church')); $booking->registrations()->save(new Registration(array('tickets' => 1))); // EventBrite bookings Booking::create(array('first' => 'Lauren', 'last' => 'Conway', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Emily', 'last' => 'Henderson', 'tickets' => 2, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sienna', 'last' => 'Yates', 'tickets' => 3, 'source' => 'EventBrite')); Booking::create(array('first' => 'Harrison', 'last' => 'Carroll', 'tickets' => 4, 'source' => 'EventBrite')); Booking::create(array('first' => 'Taylor', 'last' => 'Palmer', 'tickets' => 8, 'source' => 'EventBrite')); Booking::create(array('first' => 'Maya', 'last' => 'Marsh', 'tickets' => 10, 'source' => 'EventBrite')); Booking::create(array('first' => 'Riley', 'last' => 'Farmer', 'tickets' => 7, 'source' => 'EventBrite')); Booking::create(array('first' => 'Amelia', 'last' => 'Ashton', 'tickets' => 2, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jonathan', 'last' => 'Riley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Anthony', 'last' => 'Moss', 'tickets' => 2, 'source' => 'EventBrite')); Booking::create(array('first' => 'Ellie', 'last' => 'Henry', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sofia', 'last' => 'Phillips', 'tickets' => 2, 'source' => 'EventBrite')); Booking::create(array('first' => 'Owen', 'last' => 'Bartlett', 'tickets' => 2, 'source' => 'EventBrite')); Booking::create(array('first' => 'Alicia', 'last' => 'Jordan', 'tickets' => 4, 'source' => 'EventBrite')); Booking::create(array('first' => 'Peter', 'last' => 'Hancock', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Aidan', 'last' => 'Walker', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jennifer', 'last' => 'Sinclair', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Georgina', 'last' => 'Henry', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jonathan', 'last' => 'Barber', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Francesca', 'last' => 'Rice', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Scott', 'last' => 'Rowe', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Nathan', 'last' => 'Gould', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Harley', 'last' => 'May', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Brandon', 'last' => 'Riley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Brandon', 'last' => 'Richardson', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Adam', 'last' => 'Little', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Matthew', 'last' => 'Duncan', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Daisy', 'last' => 'Wall', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Louis', 'last' => 'Potts', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Amelie', 'last' => 'Bentley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Harriet', 'last' => 'Cameron', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jude', 'last' => 'Fraser', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Aidan', 'last' => 'Farmer', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rebecca', 'last' => 'Wallace', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Lucas', 'last' => 'Kaur', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Faith', 'last' => 'Bartlett', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Luke', 'last' => 'Cooke', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Lilly', 'last' => 'Farrell', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Peter', 'last' => 'Boyle', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'James', 'last' => 'Kay', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Nicholas', 'last' => 'Morley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Mason', 'last' => 'Kent', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sofia', 'last' => 'Freeman', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Isobel', 'last' => 'Watts', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Andrew', 'last' => 'Garner', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Henry', 'last' => 'Farmer', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Louie', 'last' => 'Fowler', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Amy', 'last' => 'Doyle', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rhys', 'last' => 'Buckley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Bradley', 'last' => 'Warren', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sean', 'last' => 'Dennis', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Muhammad', 'last' => 'Murphy', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Nicole', 'last' => 'Robertson', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Aidan', 'last' => 'Hicks', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Abigail', 'last' => 'Page', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Kieran', 'last' => 'Swift', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Isobel', 'last' => 'Austin', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jake', 'last' => 'Bradley', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Yasmin', 'last' => 'Davey', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Alice', 'last' => 'Shepherd', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Taylor', 'last' => 'Bradshaw', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Kian', 'last' => 'Payne', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sienna', 'last' => 'Wilkins', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Eleanor', 'last' => 'Collier', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Bradley', 'last' => 'Griffiths', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jay', 'last' => 'Black', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rachel', 'last' => 'Duncan', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Harriet', 'last' => 'Chadwick', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Michael', 'last' => 'Hardy', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Courtney', 'last' => 'Kennedy', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Jacob', 'last' => 'North', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Tyler', 'last' => 'Woods', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Isabelle', 'last' => 'Smart', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Aaron', 'last' => 'Norman', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Lydia', 'last' => 'Newman', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Joe', 'last' => 'Richards', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Zoe', 'last' => 'Pollard', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sam', 'last' => 'Burke', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Isabel', 'last' => 'Winter', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Francesca', 'last' => 'Alexander', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Lily', 'last' => 'Wall', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Cameron', 'last' => 'Miah', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Summer', 'last' => 'Khan', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rebecca', 'last' => 'Cooke', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Matthew', 'last' => 'Davey', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Daisy', 'last' => 'Khan', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Nathan', 'last' => 'Gough', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Phoebe', 'last' => 'Shaw', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Connor', 'last' => 'Thomas', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Abby', 'last' => 'Hurst', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Toby', 'last' => 'Simmons', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Brooke', 'last' => 'Shah', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Mia', 'last' => 'Anderson', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Luca', 'last' => "O'Sullivan", 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Zachary', 'last' => 'Welch', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Alex', 'last' => 'Baker', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Eve', 'last' => 'Wilkinson', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Oscar', 'last' => 'Parkinson', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Alex', 'last' => 'Butcher', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Zara', 'last' => 'Miller', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rosie', 'last' => 'Smith', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Aaliyah', 'last' => 'Morrison', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Adam', 'last' => 'Fisher', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Louise', 'last' => 'Francis', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Riley', 'last' => 'James', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Gabriel', 'last' => 'Andrews', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Millie', 'last' => 'Fry', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Patrick', 'last' => 'Carr', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Sofia', 'last' => 'Gould', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Ethan', 'last' => 'Humphries', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Liam', 'last' => 'Douglas', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Taylor', 'last' => 'Brady', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Yasmin', 'last' => 'Hurst', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Rosie', 'last' => "O'Neill", 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Demi', 'last' => 'Pickering', 'tickets' => 1, 'source' => 'EventBrite')); Booking::create(array('first' => 'Shannon', 'last' => 'Shaw', 'tickets' => 1, 'source' => 'EventBrite')); // "On the day" registrations that couldn't be matched to bookings Registration::create(array('tickets' => 1, 'name' => 'Joseph Brown')); Registration::create(array('tickets' => 1, 'name' => 'Mark Black')); }