/** * @test update */ public function testUpdateAjuda() { $ajuda = $this->makeAjuda(); $fakeAjuda = $this->fakeAjudaData(); $updatedAjuda = $this->ajudaRepo->update($fakeAjuda, $ajuda->id); $this->assertModelData($fakeAjuda, $updatedAjuda->toArray()); $dbAjuda = $this->ajudaRepo->find($ajuda->id); $this->assertModelData($fakeAjuda, $dbAjuda->toArray()); }
/** * @param int $id * @return Response * * @SWG\Delete( * path="/ajudas/{id}", * summary="Remove the specified Ajuda from storage", * tags={"Ajuda"}, * description="Delete Ajuda", * produces={"application/json"}, * @SWG\Parameter( * name="id", * description="id of Ajuda", * type="integer", * required=true, * in="path" * ), * @SWG\Response( * response=200, * description="successful operation", * @SWG\Schema( * type="object", * @SWG\Property( * property="success", * type="boolean" * ), * @SWG\Property( * property="data", * type="string" * ), * @SWG\Property( * property="message", * type="string" * ) * ) * ) * ) */ public function destroy($id) { /** @var Ajuda $ajuda */ $ajuda = $this->ajudaRepository->find($id); if (empty($ajuda)) { return Response::json(ResponseUtil::makeError('Ajuda not found'), 404); } $ajuda->delete(); return $this->sendResponse($id, 'Ajuda deleted successfully'); }