本文整理汇总了PHP中Booking::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::where方法的具体用法?PHP Booking::where怎么用?PHP Booking::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Booking
的用法示例。
在下文中一共展示了Booking::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
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";
}
示例2: search
/**
* Performs the registration customer/ticket search and displays the results.
*/
public function search()
{
$ticket = Input::get('ticket');
$name = Input::get('name');
if (empty($ticket) && empty($name)) {
return Redirect::route('register')->with('message', 'You must provide at least one of the search criteria');
}
if (!empty($ticket)) {
$bookings = Booking::where(function ($query) use($ticket) {
$query->where('bookings.numbers', $ticket)->orWhere('bookings.numbers', 'LIKE', "{$ticket},%")->orWhere('bookings.numbers', 'LIKE', "{$ticket} ,%")->orWhere('bookings.numbers', 'LIKE', "%,{$ticket},%")->orWhere('bookings.numbers', 'LIKE', "%, {$ticket},%")->orWhere('bookings.numbers', 'LIKE', "%, {$ticket} ,%")->orWhere('bookings.numbers', 'LIKE', "%,{$ticket} ,%")->orWhere('bookings.numbers', 'LIKE', "%, {$ticket}")->orWhere('bookings.numbers', 'LIKE', "%,{$ticket}");
})->orderBy('bookings.first')->orderBy('bookings.last')->get();
}
if (!empty($name) && (!isset($bookings) or $bookings->count() == 0)) {
$parts = explode(' ', $name);
if (count($parts) > 1) {
$bookings = Booking::where(function ($query) use($parts) {
$query->where('bookings.first', 'LIKE', "%{$parts[0]}%")->where('bookings.last', 'LIKE', "%{$parts[1]}%");
})->orderBy('bookings.first')->orderBy('bookings.last')->get();
} else {
$bookings = Booking::where(function ($query) use($name) {
$query->where('bookings.first', 'LIKE', "%{$name}%")->orWhere('bookings.last', 'LIKE', "%{$name}%");
})->orderBy('bookings.first')->orderBy('bookings.last')->get();
}
}
$booking_count = $bookings->count();
if ($booking_count == 0) {
return Redirect::route('register')->withInput()->with('message', 'No booking found!');
}
$this->layout->with('subtitle', 'Register a delegate');
$this->layout->content = View::make('registrations.register')->with('bookings', $bookings);
}
示例3: register
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());
}
}
示例4: totalCreditFromAllBookings
public static function totalCreditFromAllBookings()
{
$bookings = Booking::where('user_id', Auth::id())->get();
$total = 0;
foreach ($bookings as $booking) {
$total += Booking::getTotalBookingAmount($booking);
}
return $total;
}
示例5: update
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;
}
示例6: view
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);
}
示例7: paymentGet
public function paymentGet()
{
if (isset($_GET)) {
$amount = HsbcPayment::null2unknown($_GET["vpc_Amount"]);
$locale = HsbcPayment::null2unknown($_GET["vpc_Locale"]);
$batchNo = HsbcPayment::null2unknown($_GET["vpc_BatchNo"]);
$command = HsbcPayment::null2unknown($_GET["vpc_Command"]);
$message = HsbcPayment::null2unknown($_GET["vpc_Message"]);
$version = HsbcPayment::null2unknown($_GET["vpc_Version"]);
$cardType = HsbcPayment::null2unknown($_GET["vpc_Card"]);
$orderInfo = HsbcPayment::null2unknown($_GET["vpc_OrderInfo"]);
$receiptNo = HsbcPayment::null2unknown($_GET["vpc_ReceiptNo"]);
$merchantID = HsbcPayment::null2unknown($_GET["vpc_Merchant"]);
$authorizeID = HsbcPayment::null2unknown($_GET["vpc_AuthorizeId"]);
$merchTxnRef = HsbcPayment::null2unknown($_GET["vpc_MerchTxnRef"]);
$transactionNo = HsbcPayment::null2unknown($_GET["vpc_TransactionNo"]);
$acqResponseCode = HsbcPayment::null2unknown($_GET["vpc_AcqResponseCode"]);
$txnResponseCode = HsbcPayment::null2unknown($_GET["vpc_TxnResponseCode"]);
$verType = array_key_exists("vpc_VerType", $_GET) ? $_GET["vpc_VerType"] : "No Value Returned";
$verStatus = array_key_exists("vpc_VerStatus", $_GET) ? $_GET["vpc_VerStatus"] : "No Value Returned";
$token = array_key_exists("vpc_VerToken", $_GET) ? $_GET["vpc_VerToken"] : "No Value Returned";
$verSecurLevel = array_key_exists("vpc_VerSecurityLevel", $_GET) ? $_GET["vpc_VerSecurityLevel"] : "No Value Returned";
$enrolled = array_key_exists("vpc_3DSenrolled", $_GET) ? $_GET["vpc_3DSenrolled"] : "No Value Returned";
$xid = array_key_exists("vpc_3DSXID", $_GET) ? $_GET["vpc_3DSXID"] : "No Value Returned";
$acqECI = array_key_exists("vpc_3DSECI", $_GET) ? $_GET["vpc_3DSECI"] : "No Value Returned";
$authStatus = array_key_exists("vpc_3DSstatus", $_GET) ? $_GET["vpc_3DSstatus"] : "No Value Returned";
$payment_info = HsbcPayment::where('HSBC_payment_id', $merchTxnRef);
if ($payment_info) {
$qsi_res_code = HsbcPayment::getResponseDescription($txnResponseCode);
$pay = array();
$pay = array('paid_amount' => $amount / 100, 'vpc_txn_res_code' => $txnResponseCode, 'qsi_res_code' => $qsi_res_code, 'vpc_message' => $message, 'vpc_receipt_number' => $receiptNo, 'vpc_txn_no' => $transactionNo, 'vpc_acq_res_code' => $acqResponseCode, 'vpc_bank_auth_id' => $authorizeID, 'vpc_batch_no' => $batchNo, 'card_type' => $cardType, 'vpc_merchant' => $merchantID, 'vpc_command' => $command, 'vpc_version' => $version, 'vpc_Locale' => $locale, 'vpc_OrderInfo' => $orderInfo);
$HSBC_payments = DB::table('hsbc_payments')->where('HSBC_payment_id', $merchTxnRef)->update($pay);
if (substr_count($orderInfo, 'A') != 0) {
if ($txnResponseCode == 0) {
$mybooking = 0;
$payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking));
$booking = Booking::where('payment_reference_number', $orderInfo)->first();
$this->sendBookingEmails($booking);
}
}
if (substr_count($orderInfo, 'B') != 0) {
if ($txnResponseCode == 0) {
$mybooking = 0;
$payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking));
$booking = Booking::where('payment_reference_number', $orderInfo)->first();
$this->sendBookingEmails($booking);
}
}
if (substr_count($orderInfo, 'O') != 0) {
if ($txnResponseCode == 0) {
$mybooking = 0;
$payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking));
$booking = Booking::where('payment_reference_number', $orderInfo)->first();
$payment = Payment::where('reference_number', $orderInfo)->first();
//dd($booking->email);
// Mail::send('emails/online-payment', array(
// 'payment' => $payment,
// 'booking' => $booking
// ), function ($message) use ($booking) {
// $message->subject('Online Payment Receipt : ' . $booking->reference_number)
// ->from('noreply@srilankahotels.travel', 'SriLankaHotels.Travel')
// ->bcc('admin@srilankahotels.travel')
// ->to('tharindarodrigo@gmail.com');
// });
Mail::send('emails/online-payment', array('booking' => $booking, 'payment' => $payment), function ($message) use($booking, $payment) {
$message->subject('Payment : ' . $payment->reference_number)->from('noreply@srilankahotels.travel', 'SriLankaHotels.Travel')->to($booking->email, $booking->booking_name)->bcc('admin@srilankahotels.travel', 'Admin');
});
Session::flash('global', 'Thank you for paying online. </br> We have emailed you the online payment invoice');
// return View::make('pages.message');
}
Session::flash('global', 'Sorry Your Payment was unsuccessful!');
// return View::make('pages.message');
}
if (substr_count($orderInfo, 'AP') != 0) {
if ($txnResponseCode == 0) {
$mybooking = 0;
$payment = DB::table('payments')->where('HSBC_payment_id', $merchTxnRef)->update(array('my_booking' => $mybooking));
$booking = Booking::where('payment_reference_number', $orderInfo)->first();
$this->sendBookingEmails($booking);
}
}
$url = "http://srilankahotels.travel/message";
header("Location: {$url}");
exit;
} else {
die("An error occurred. Please contact administrator");
}
} else {
header("Location:index.php");
exit;
}
}
示例8: update
public function update($id)
{
$today = date("Y-m-d H:i:s");
$i = Input::all();
$bookingRemarks = '';
$addition = 0;
$deduction = 0;
if ($i['savethis'] == true) {
$addition -= $i['price_addition'];
$deduction += $i['price_deduction'];
}
$booking = Booking::where('id', $id)->with('reservedRoom.room.roomDetails')->first();
//$booking = ReservedRoom::where('id', $id)->with('room.roomDetails')->first();
$old_status = $booking->status;
$current_price = $booking->price;
$current_price += $addition + $deduction;
if (!empty($booking)) {
$booking->status = $i['status'];
if ($i['status'] == 5) {
$booking->cancelled_at = $today;
$booking->paid = 0;
$booking->price = 0;
$booking->cancelled_remarks = $i['cancelled_remarks'];
} else {
if ($i['status'] == 1) {
$booking->paid = $i['paid'];
} else {
//$booking->paid=0;
$booking->price = $current_price;
$booking->cancelled_remarks = '';
$booking->cancelled_at = '0000-00-00 00:00:00';
}
}
if ($booking->save()) {
if ($i['savethis'] == true) {
$newBookingRemarks = new BookingRemarksHistory();
$newBookingRemarks->additional = $addition;
$newBookingRemarks->deduction = $deduction;
$newBookingRemarks->remarks = $i['bookingremarks'];
$newBookingRemarks->booking_id = $id;
$newBookingRemarks->save();
}
$roomReserved = ReservedRoom::where('booking_id', $booking->id)->get();
foreach ($roomReserved as $rr) {
$rr->status = $i['status'];
$rr->save();
}
$a = new Activity();
$a->actor = Auth::id();
$a->location = 3;
$a->logs = 'Updated booking ID of:' . $booking->id . ' by ' . $booking->firstname . ' ' . $booking->lastname . ' from ' . $this->bookingStatus($old_status) . ' to ' . $this->bookingStatus($booking->status);
//before to after status.
$a->save();
return $booking;
} else {
return '0';
//means failed
}
}
}
示例9: function
});
Route::get('getbookinglist', 'BookingController@bookingList');
Route::post('getbookinglist/search', 'BookingController@searchList');
Route::post('getbookinginfo/{id}', 'BookingController@searchBooking');
Route::post('booking/{id}/update', 'BookingController@update');
Route::post('booking/{id}/payment', 'BookingController@payment');
Route::post('currentbooking/save', function () {
$i = Input::all();
$membershipDiscount = null;
if (isset($i['membership_id'])) {
$membership = Customer::where('membership_id', $i['membership_id'])->first();
if ($membership) {
$membershipDiscount = $membership->current_discount;
}
}
$booking = Booking::where('id', $i['booking_id'])->first();
if ($booking) {
$booking->firstname = $i['firstname'];
$booking->lastname = $i['lastname'];
$booking->address = $i['address'];
$booking->contact_number = $i['contact_no'];
$booking->status = 1;
$booking->save();
$reservation = ReservedRoom::where('booking_id', $i['booking_id'])->get();
if (count($reservation) > 0) {
foreach ($reservation as $r) {
$r->firstname = Input::has('firstname') ? $i['firstname'] : 'WALK-IN';
$r->lastname = Input::has('lastname') ? $i['lastname'] : 'WALK-IN';
$r->address = Input::has('address') ? $i['address'] : 'WALK-IN';
$r->contact_number = Input::has('contact_no') ? $i['contact_no'] : 'WALK-IN';
$r->status = 1;
示例10: getBookingData
public static function getBookingData($booking_id)
{
return Booking::where('id', $booking_id)->with('client')->with('flightDetail')->with('voucher')->with('invoice')->with('customTrip')->with('predefinedTrip')->first();
}
示例11: todayBookingSuccess
public function todayBookingSuccess()
{
$today = date('Y-m-d');
//$today_stats = ReservedRoom::where('created_at','>', $today)->get();
$today_stats = Booking::where('created_at', '>', $today)->get();
$cpage = 'dashboard';
return View::make('adminview.dashboard.success_bookings', compact('cpage', 'success_bookings'));
}
示例12: destroy
public function destroy($kitID)
{
$kit = Kits::find($kitID);
foreach (Booking::where('KitID', '=', $kitID)->get() as $book) {
foreach (BookingDetails::where('BookingID', '=', $book->ID)->get() as $detail) {
BookingDetails::destroy($detail->ID);
}
Booking::destroy($book->ID);
}
foreach ($kit->contents as $content) {
KitContents::destroy($content->ID);
}
Kits::destroy($kitID);
}
示例13: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$bookings = Booking::where('userId', $id)->get();
return Response::json($bookings);
}
示例14: getIndex
public function getIndex()
{
return View::make('bookings.index')->with('bookings', Booking::where('user_id', '=', Auth::user()->id)->orderBy('created_at', 'DESC')->paginate(10));
}
示例15: getWeekStats
public static function getWeekStats()
{
$dateTime = new \DateTime('First Monday of this month');
$startUts = $dateTime->format('U');
$dateTime->modify('+6 week');
$endUts = $dateTime->format('U');
$bookings = Booking::where('startUts', '>=', $startUts)->where('startUts', '<', $endUts)->where('user_id', UserFrosting::getInstance()->user->id)->get(['startUts', 'status']);
$data = array();
foreach ($bookings as $booking) {
$week = strftime('%G W%V', $booking->startUts);
if (!isset($data[$week])) {
$data[$week] = array('period' => $week, 'new' => 0, 'accepted' => 0, 'rejected' => 0);
}
$data[$week][$booking->status]++;
}
$response = new \StdClass();
$response->data = $data;
$response->json = json_encode(array_values($data));
$response->title = strftime('%e %b', $startUts) . ' - ' . strftime('%e %b', $endUts - 10800);
return $response;
}