public function postEdit(Request $request, ChildRepository $childRepository, $id)
 {
     $child = Child::findOrFail($id);
     $this->validate($request, Child::$rules);
     $childRepository->update($child, $request->all());
     return redirect()->action('ChildrenController@getIndex');
 }
Пример #2
0
 public function getEdit(ParentRepository $parentRepository, TariffRepository $tariffRepository, ChildRepository $childRepository, $id)
 {
     $parent = ParentModel::findOrFail($id);
     $parent = $parentRepository->prepareForForm($parent);
     $tariffs = $tariffRepository->getTariffForSelect();
     $children = $childRepository->getChildrenForSelect();
     return view('parents.parentsEdit', compact('parent', 'children', 'tariffs'));
 }
Пример #3
0
 /**
  * @api {post} /events/  Сохранить событие
  * @apiName postEvent
  * @apiGroup Events
  *
  * @apiParam {Int} card_number Номер карточки ребенка
  * @apiParam {Int} event_type_id Тип события (Зашел = 1 / Вышел = 2)
  *
  * @apiSuccessExample Success-Response:
  *     HTTP/1.1 200 OK
  *
  * {
  * "card_number": "87771",
  * "event_type_id": "1",
  * "updated_at": "2016-02-26 15:31:31",
  * "created_at": "2016-02-26 15:31:31",
  * "id": 10
  * }
  *
  * сохранить событие от турникета
  * @param Request $request
  * @param EventRepository $eventRepository
  * @param ChildRepository $childRepository
  * @return static
  */
 public function postIndex(Request $request, EventRepository $eventRepository, ChildRepository $childRepository)
 {
     /**
      * проверим, есть ли ребенок с такой карточкой
      */
     $child = $childRepository->getChildByCardNumber($request->get('card_number'));
     if (!$child) {
         return response('That cardNumber doesnt exist!', 404);
     }
     return $eventRepository->create($request->all());
 }