当前位置: 首页>>代码示例>>PHP>>正文


PHP Booking::findOrFail方法代码示例

本文整理汇总了PHP中Booking::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Booking::findOrFail方法的具体用法?PHP Booking::findOrFail怎么用?PHP Booking::findOrFail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Booking的用法示例。


在下文中一共展示了Booking::findOrFail方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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());
     }
 }
开发者ID:ajwgibson,项目名称:leadership,代码行数:34,代码来源:RegistrationController.php

示例2: unregister

 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!');
 }
开发者ID:ajwgibson,项目名称:leadership,代码行数:7,代码来源:BookingController.php

示例3: register_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!');
 }
开发者ID:ajwgibson,项目名称:illuminate,代码行数:11,代码来源:RegistrationController.php

示例4: update

 /**
  * Update the specified booking in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($id)
 {
     $booking = Booking::findOrFail($id);
     if (Input::has('val')) {
         $rules = ['val'];
         //dd('<pre>',Booking::with('Voucher')->where('id',$id)->first(), '</pre>');
         $bookingVouchers = Booking::whereHas('Voucher', function ($q) {
             $q->where('vouchers.val', 1);
         })->where('id', $id);
         //dd($booking->count());
         if ($bookingVouchers->count() > 0) {
             Session::flash("booking_cancellation_error_" . $id, "<b>Sorry</b>, You cannot cancel the above booking! You have " . $booking->first()->voucher->count() . " active vouchers");
         } else {
             $booking->update(array('val' => Input::get('val')));
             Session::flash('success', 'successfully Updated');
         }
         return Redirect::back();
     }
     $validator = Validator::make($data = Input::all(), Booking::$agentRules);
     if ($validator->fails()) {
         //dd($validator->errors());
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['user_id'] = Auth::id();
     $booking->update($data);
     return Redirect::back();
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:33,代码来源:BookingsController.php

示例5: clear

 public function clear($leadership_event_id, $activity_id, $booking_id)
 {
     $booking = Booking::findOrFail($booking_id);
     $booking->activities()->detach($activity_id);
     return Redirect::route('signup', array($leadership_event_id, $activity_id))->with('info', 'Sign-up cleared!');
 }
开发者ID:ajwgibson,项目名称:leadership,代码行数:6,代码来源:SignupController.php

示例6: amendBooking

 public static function amendBooking($bookingid)
 {
     $booking = Booking::findOrFail($bookingid);
     $booking->count = ++$booking->count;
     return $booking->save() ? true : false;
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:6,代码来源:Booking.php

示例7: store

 public function store()
 {
     $kit = Kits::findOrFail(Input::get('ID'));
     foreach ($kit->contents as $content) {
         if (Input::has('isMissing_' . $content->ID) && Input::get('isMissing_' . $content->ID) == '1' && $content->MissingLogID == null) {
             $message = Input::get('MissingID_' . $content->ID);
             $logID = Logs::MissingReport($kit->KitType, $kit->ID, $content->ID, $message);
             $content->MissingLogID = $logID;
         }
         if (Input::has('isDamaged_' . $content->ID) && Input::get('isDamaged_' . $content->ID) == '1' && $content->DamagedLogID == null) {
             $message = Input::get('DamagedID_' . $content->ID);
             $logID = Logs::DamageReport($kit->KitType, $kit->ID, $content->ID, $message);
             $content->DamagedLogID = $logID;
         }
         $content->save();
     }
     if (Input::has('LogMessage') && strlen(Input::get('LogMessage')) > 0) {
         $message = Input::get('LogMessage');
         $logNote = Logs::Note($kit->KitType, $kit->ID, NULL, $message);
     }
     $booking = Booking::findOrFail(Input::get('BookingID'));
     $kit->KitState = 1;
     $kit->AtBranch = $booking->ForBranch;
     $kit->save();
     return Redirect::action('recieve_kit.index');
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:26,代码来源:RecieveKitController.php

示例8: findKit

 public function findKit($bookingID)
 {
     $branch = Branches::find(Session::get('branch'));
     // If the session is not set, default to the IT depot
     if (!isset($branch)) {
         $branch = Branches::find(0);
     }
     // Get Kits to be received
     $data = DB::select('SELECT
                           K.ID AS KitID, K.KitType, K.Name AS KitName, K.AtBranch, K.KitState, K.BarcodeNumber, K.Specialized,  K.SpecializedName,
                           B.ID as BookingID, B.ForBranch, B.StartDate, B.EndDate, B.ShadowStartDate, B.ShadowEndDate, B.Purpose,
                           KS.StateName,
                           KT.Name AS KitTypeName, KT.TypeDescription as KitTypeDesc
                           FROM Booking AS B
                             INNER JOIN Kits as K ON (K.ID = B.KitID)
                               INNER JOIN KitTypes AS KT ON (KT.ID = K.KitType)
                               INNER JOIN KitSTate AS KS ON (KS.ID = K.KitState)
                          WHERE now() BETWEEN DATE_ADD(B.ShadowStartDate, INTERVAL -1 DAY) AND B.ShadowEndDate
                                AND B.ForBranch = ?
                                AND B.ForBranch <> K.AtBranch
                                ORDER BY BookingID
                                ', array($branch->ID));
     // Get Kits to be sent out
     $data2 = DB::select('SELECT
                           K.ID AS KitID, K.KitType, K.Name AS KitName, K.AtBranch, K.KitState, K.BarcodeNumber, K.Specialized,  K.SpecializedName,
                           B.ID as BookingID, B.ForBranch, B.StartDate, B.EndDate, B.ShadowStartDate, B.ShadowEndDate, B.Purpose,
                           KS.StateName,
                           KT.Name AS KitTypeName, KT.TypeDescription as KitTypeDesc
                           FROM Booking AS B
                             INNER JOIN Kits as K ON (K.ID = B.KitID)
                               INNER JOIN KitTypes AS KT ON (KT.ID = K.KitType)
                               INNER JOIN KitSTate AS KS ON (KS.ID = K.KitState)
                          WHERE now() BETWEEN DATE_ADD(B.ShadowStartDate, INTERVAL -1 DAY) AND B.ShadowEndDate
                                AND K.AtBranch = ?
                                AND B.ForBranch <> K.AtBranch
                                ORDER BY BookingID
                                ', array($branch->ID));
     $findBookID = Booking::findOrFail($bookingID);
     $theBookID = $findBookID->ID;
     return CheckIfAuthenticated('members.receiveKitManagement', ['mode' => 'send', 'branch' => $branch, 'selected_menu' => 'main-menu-receive', 'receiveKits' => $data, 'sendKits' => $data2, 'findBookID' => $theBookID, 'kitTypes' => KitTypes::all()], 'home.index', [], false);
 }
开发者ID:KWinston,项目名称:EPLProject,代码行数:41,代码来源:ShipKitController.php

示例9: update

 /**
  * Update the specified flightdetail in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update($bookingId, $id)
 {
     $user = Auth::user();
     Session::flash('bookings_show_tabs', 'flight-details-tab');
     $flightdetail = FlightDetail::findOrFail($id);
     $data = [];
     $data['date'] = Input::get('date_' . $id);
     $data['time'] = Input::get('time_' . $id);
     $data['flight'] = Input::get('flight_' . $id);
     $data['flight_type'] = Input::get('flight_type_' . $id);
     $validator = Validator::make($data, FlightDetail::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($flightdetail->update($data)) {
         $booking = Booking::getBookingData($bookingId);
         $Currentbooking = Booking::findOrFail($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();
 }
开发者ID:tharindarodrigo,项目名称:agent,代码行数:43,代码来源:FlightDetailsController.php

示例10: cancel

 public function cancel($id)
 {
     $booking = Booking::findOrFail($id);
     $booking->status = 'cancelled';
     $booking->update();
     return Redirect::route('bookings.index');
 }
开发者ID:kenkode,项目名称:umash-1,代码行数:7,代码来源:BookingsController.php


注:本文中的Booking::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。