/**
  * @test delete
  */
 public function testDeleteAjuda()
 {
     $ajuda = $this->makeAjuda();
     $resp = $this->ajudaRepo->delete($ajuda->id);
     $this->assertTrue($resp);
     $this->assertNull(Ajuda::find($ajuda->id), 'Ajuda should not exist in DB');
 }
Пример #2
0
 /**
  * @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');
 }
Пример #3
0
 /**
  * Remove the specified Ajuda from storage.
  *
  * @param  int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $ajuda = $this->ajudaRepository->findWithoutFail($id);
     if (empty($ajuda)) {
         Flash::error('Ajuda not found');
         return redirect(route('ajudas.index'));
     }
     $this->ajudaRepository->delete($id);
     Flash::success('Ajuda deleted successfully.');
     return redirect(route('ajudas.index'));
 }