本文整理汇总了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');
}
示例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;
}
示例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');
//.........这里部分代码省略.........