/** * @test update */ public function testUpdateUserOng() { $userOng = $this->makeUserOng(); $fakeUserOng = $this->fakeUserOngData(); $updatedUserOng = $this->userOngRepo->update($fakeUserOng, $userOng->id); $this->assertModelData($fakeUserOng, $updatedUserOng->toArray()); $dbUserOng = $this->userOngRepo->find($userOng->id); $this->assertModelData($fakeUserOng, $dbUserOng->toArray()); }
/** * @param int $id * @param UpdateUserOngAPIRequest $request * @return Response * * @SWG\Put( * path="/userOngs/{id}", * summary="Update the specified UserOng in storage", * tags={"UserOng"}, * description="Update UserOng", * produces={"application/json"}, * @SWG\Parameter( * name="id", * description="id of UserOng", * type="integer", * required=true, * in="path" * ), * @SWG\Parameter( * name="body", * in="body", * description="UserOng that should be updated", * required=false, * @SWG\Schema(ref="#/definitions/UserOng") * ), * @SWG\Response( * response=200, * description="successful operation", * @SWG\Schema( * type="object", * @SWG\Property( * property="success", * type="boolean" * ), * @SWG\Property( * property="data", * ref="#/definitions/UserOng" * ), * @SWG\Property( * property="message", * type="string" * ) * ) * ) * ) */ public function update($id, UpdateUserOngAPIRequest $request) { $input = $request->all(); /** @var UserOng $userOng */ $userOng = $this->userOngRepository->find($id); if (empty($userOng)) { return Response::json(ResponseUtil::makeError('UserOng not found'), 404); } $userOng = $this->userOngRepository->update($input, $id); return $this->sendResponse($userOng->toArray(), 'UserOng updated successfully'); }