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


PHP Services::find方法代码示例

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


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

示例1: getDelete

 public function getDelete($id)
 {
     $services = Services::find($id);
     $services->delete();
     Session::flash('message', 'The records are deleted successfully');
     return Redirect::to('services');
 }
开发者ID:andrinda,项目名称:myhotel,代码行数:7,代码来源:ServicesController.php

示例2: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $service = Services::find($id);
     $service->serviciablePets()->detach();
     if ($service->delete()) {
         return Response::json('Service successfully deleted.');
     }
     return false;
 }
开发者ID:pramodvkadam,项目名称:petService,代码行数:15,代码来源:ServiceController.php

示例3: getSave

 public function getSave()
 {
     $id = Input::get('id');
     $year = date('Y');
     $month = date('m');
     $date = date('d');
     $now = date('Y-m-d');
     if ($id) {
         // print_r($_POST);
         $employee_id = Input::get('employee_id');
         if ($employee_id) {
             $employee_id = Input::get('employee_id');
         } else {
             $employee_id = NULL;
         }
         $bs = BookingServices::where('booking_id', $id);
         $bs->delete();
         $br = BookingRooms::where('booking_id', $id);
         $br->delete();
         $bookings = Bookings::find($id);
         $service_id = Input::get('service_id');
         $TOTAL = 0;
         for ($i = 0; $i < count($service_id); $i++) {
             $cek_bs = BookingServices::where('service_id', '=', $service_id[$i])->first();
             if (empty($cek_bs)) {
                 $booking_service = new BookingServices();
                 $d_service = Services::find($service_id[$i]);
                 $booking_service->booking_id = $id;
                 $booking_service->service_id = $service_id[$i];
                 $booking_service->price = $d_service->price;
                 $TOTAL += $d_service->price;
                 $booking_service->save();
             }
         }
         $room_id = Input::get('room_id');
         for ($j = 0; $j < count($room_id); $j++) {
             $cek_r = BookingRooms::where('room_id', '=', $room_id[$j])->first();
             if (empty($cek_r)) {
                 $booking_room = new BookingRooms();
                 $d_room = Room::find($room_id[$j]);
                 $d_room->booked = 1;
                 $booking_room->booking_id = $id;
                 $booking_room->room_id = $room_id[$j];
                 $booking_room->price = $d_room->type->price;
                 $booking_room->save();
                 $d_room->save();
                 $TOTAL += $d_room->type->price;
             }
         }
         $bookings->guest_id = Input::get('guest_id');
         $bookings->employee_id = $employee_id;
         $bookings->number_of_days = Input::get('number_of_days');
         $bookings->date_booking = Input::get('date_booking');
         $bookings->date_booking_from = Input::get('date_booking');
         $bookings->date_booking_to = Input::get('date_booking_to');
         $bookings->save();
         $holiday = date('D');
         if ($holiday == 'Sat' || $holiday == 'Sun') {
             $disc = 0.05;
         } else {
             $disc = 0;
         }
         $TOTAL = $TOTAL * $bookings->number_of_days;
         $discount = $TOTAL * $disc;
         $grand_total = $TOTAL - $discount;
         $py = Payments::where('booking_id', '=', $id)->first();
         $payment = Payments::find($py->id);
         $payment->subtotal = $TOTAL;
         $payment->disc = $disc;
         $payment->grand_total = $grand_total;
         $payment->cashed = 0;
         $payment->save();
         Session::flash('message', 'The records are updated successfully');
         return Redirect::to('bookings/show/' . $id);
     } else {
         $data = Bookings::orderBy('id', 'desc')->first();
         if (isset($data->id)) {
             $index = $data->id + 1;
         } else {
             $index = 1;
         }
         $x = strlen($index);
         $y = null;
         for ($i = 4; $i > $x; $i--) {
             $y .= '0';
         }
         $y .= $index;
         $booking_code = $year . '' . $month . '' . $date . '' . $y;
         $employee_id = Input::get('employee_id');
         if ($employee_id) {
             $employee_id = Input::get('employee_id');
         } else {
             $employee_id = NULL;
         }
         $bookings = new Bookings();
         $bookings->booking_code = $booking_code;
         $bookings->guest_id = Input::get('guest_id');
         $bookings->employee_id = $employee_id;
         $bookings->number_of_days = Input::get('number_of_days');
         $bookings->date_booking = Input::get('date_booking');
//.........这里部分代码省略.........
开发者ID:andrinda,项目名称:myhotel,代码行数:101,代码来源:BookingController.php


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