| @@ 39-62 (lines=24) @@ | ||
| 36 | return view('list', $viewData); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function store(GuestRequest $request, $id = null) |
|
| 40 | { |
|
| 41 | if ($id === null) { |
|
| 42 | $object = new Guest(); |
|
| 43 | } else { |
|
| 44 | try { |
|
| 45 | $object = Guest::findOrFail($id); |
|
| 46 | } catch (ModelNotFoundException $e) { |
|
| 47 | return Controller::returnBack([ |
|
| 48 | 'message' => trans('general.object_not_found'), |
|
| 49 | 'alert-class' => 'alert-danger', |
|
| 50 | ]); |
|
| 51 | } |
|
| 52 | } |
|
| 53 | ||
| 54 | $object->fill($request->all()); |
|
| 55 | $object->save(); |
|
| 56 | ||
| 57 | return redirect()->route($this->getRouteName().'.index') |
|
| 58 | ->with([ |
|
| 59 | 'message' => trans('general.saved'), |
|
| 60 | 'alert-class' => 'alert-success', |
|
| 61 | ]); |
|
| 62 | } |
|
| 63 | ||
| 64 | public function delete($id) |
|
| 65 | { |
|
| @@ 43-66 (lines=24) @@ | ||
| 40 | } |
|
| 41 | ||
| 42 | // TODO |
|
| 43 | public function store(GuestRequest $request, $id = null) |
|
| 44 | { |
|
| 45 | if ($id === null) { |
|
| 46 | $object = new Reservation(); |
|
| 47 | } else { |
|
| 48 | try { |
|
| 49 | $object = Reservation::findOrFail($id); |
|
| 50 | } catch (ModelNotFoundException $e) { |
|
| 51 | return Controller::returnBack([ |
|
| 52 | 'message' => trans('general.object_not_found'), |
|
| 53 | 'alert-class' => 'alert-danger', |
|
| 54 | ]); |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| 58 | $object->fill($request->all()); |
|
| 59 | $object->save(); |
|
| 60 | ||
| 61 | return redirect()->route($this->getRouteName().'.index') |
|
| 62 | ->with([ |
|
| 63 | 'message' => trans('general.saved'), |
|
| 64 | 'alert-class' => 'alert-success', |
|
| 65 | ]); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function delete($id) |
|
| 69 | { |
|
| @@ 38-61 (lines=24) @@ | ||
| 35 | return view('list', $viewData); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function store(RoomRequest $request, $id = null) |
|
| 39 | { |
|
| 40 | if ($id === null) { |
|
| 41 | $object = new Room(); |
|
| 42 | } else { |
|
| 43 | try { |
|
| 44 | $object = Room::findOrFail($id); |
|
| 45 | } catch (ModelNotFoundException $e) { |
|
| 46 | return Controller::returnBack([ |
|
| 47 | 'message' => trans('general.object_not_found'), |
|
| 48 | 'alert-class' => 'alert-danger', |
|
| 49 | ]); |
|
| 50 | } |
|
| 51 | } |
|
| 52 | ||
| 53 | $object->fill($request->all()); |
|
| 54 | $object->save(); |
|
| 55 | ||
| 56 | return redirect()->route($this->getRouteName().'.index') |
|
| 57 | ->with([ |
|
| 58 | 'message' => trans('general.saved'), |
|
| 59 | 'alert-class' => 'alert-success', |
|
| 60 | ]); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function delete($id) |
|
| 64 | { |
|