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