當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。