本文整理汇总了PHP中Booking::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::find方法的具体用法?PHP Booking::find怎么用?PHP Booking::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booking
的用法示例。
在下文中一共展示了Booking::find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
/**
* Show the form for editing the specified booking.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$booking = Booking::find($id);
$clients = Client::all();
$cars = Car::all();
return View::make('bookings.edit', compact('booking', 'cars', 'clients'));
}
示例2: postManage
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');
}
示例3: thankyou
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('dale@bluewell.com.au', 'Not Normal Tours')->subject('New Booking at Not Normal Tours');
});
return View::make('pages.thankyou');
}
return View::make('pages.thankyou');
}
示例4: sendBookingEmails
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);
}
}
});
}
}
示例5: update
/**
* 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();
}
示例6: deleteAjax
public function deleteAjax()
{
$booking_id = Input::get('booking_id');
$booking_item_id = Input::get('id');
$booking = Booking::find($booking_id);
if (!$booking) {
return Response::json(array('status' => 'KO', 'message' => 'Réservation inconnue'));
}
$user = $booking->user;
$booking_item = BookingItem::find($booking_item_id);
$ressource = $booking_item->ressource;
if ($booking->items()->count() == 1) {
BookingItem::destroy($booking_item_id);
Booking::destroy($booking_id);
} else {
BookingItem::destroy($booking_item_id);
}
try {
$this->sendDeletedBookingNotification($booking_item, $ressource, $booking, $user);
} catch (\Exception $e) {
}
if (Request::ajax()) {
return Response::json(array('status' => 'OK', 'id' => $booking_item_id));
}
return Redirect::route('booking_list')->with('mSuccess', 'La réservation a été supprimée');
}
示例7: complete
public function complete()
{
$booking = Booking::find(Input::get('payment_reference'));
$booking->receipt = Input::all();
$booking->save();
return true;
}
示例8: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$booking = Booking::find($id);
$booking->delete();
return Response::json(array('code' => '200', 'info' => 'Booking has been deleted.'));
}
示例9: function
});
Route::get('booking/{id}', function ($id) {
// $hotel_users = DB::table('users')->leftJoin('hotel_user', 'users.id', '=', 'hotel_user.user_id')
// ->where('hotel_user.hotel_id', 1065)
// ->get();
$booking = Booking::find($id);
$pdf = PDF::loadView('emails/booking', array('booking' => $booking));
return $pdf->stream();
});
Route::get('invoice/{id}', function ($id) {
$booking = Booking::find($id);
$pdf = PDF::loadView('emails/invoice', array('booking' => $booking));
return $pdf->stream();
});
Route::get('service-voucher/{id}', function ($id) {
$booking = Booking::find($id);
$pdf = PDF::loadView('emails/service-voucher', array('booking' => $booking));
return $pdf->stream();
});
});
//auto complete route
Route::post('auto-complete', array('as' => 'auto-complete', 'uses' => 'HotelController@autoComplete'));
// Online Hotel Payments To gateway
Route::any('/payments-send', array('as' => 'online-hotel-payments', 'uses' => 'HsbcPaymentsController@sendPayment'));
// Online Hotel Payments email
Route::any('/online-hotel-payments-send-email', array('as' => 'online-hotel-payments-send-email', 'uses' => 'BookingsController@storeAllDataAndSendEmails'));
Route::any('/online-agent-payments-send-email', array('as' => 'online-agent-payments-send-email', 'uses' => 'PageController@storeAllDataAndSendEmails'));
Route::get('/online-hotel-payments', function () {
return View::make('payment_send');
});
Route::any('/send-payment-gateway', array('as' => 'send-payment-gateway', 'uses' => 'HsbcPaymentsController@sendToPaymentGateway'));
示例10: delete
/**
* GET /bookings/delete?id=
*/
public function delete()
{
self::authorize_user();
$booking = Booking::find($_GET['id']);
$booking->delete();
self::redirect_to('bookings/index');
}