コード例 #1
0
 public function getReservation(Request $request, $number)
 {
     $reservation = Reservation::find($number);
     if ($reservation) {
         $reservation['rooms'] = ReservationController::getRoomsForReservation($number);
         $reservation['since'] = date("Y-m-d\\TH:i:s.000\\Z", strtotime($reservation['since']));
         $reservation['till'] = date("Y-m-d\\TH:i:s.000\\Z", strtotime($reservation['till']));
         return response()->json($reservation);
     } else {
         return response('Rezerwacja nie została odnaleziona.', 404)->header('Content-Type', 'text/html; charset=utf-8');
     }
 }
コード例 #2
0
 /**
  * Remove the specified reservation from storage.
  *
  * @see \App\Http\Controllers\ReservationController::destroy()
  * @param  int $id
  * @return \Illuminate\Http\Response
  * @internal param Request $request
  */
 public function destroy($id)
 {
     try {
         extract(parent::destroy($id));
     } catch (ModelNotFoundException $e) {
         return response()->json(['error' => 'not_found', 'error_description' => "The reservation with the id '{$id}' doesn't exist."], 404);
     }
     return response(null, 204);
 }
コード例 #3
0
 /**
  * Remove the specified reservation from storage.
  *
  * @see \App\Http\Controllers\ReservationController::destroy()
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     extract(parent::destroy($id));
     return back();
 }