/** * @param $id * @return \Illuminate\Http\JsonResponse */ public function destroy($id) { try { $this->repository->delete($id); $msg = "Client {$id} removido com sucesso."; Log::info($msg); return response()->json([$msg], 200); } catch (ModelNotFoundException $e) { return response()->json([$e->getMessage()], 404); } //QueryException tratado em Exceptions/Handler.php }
/** * Display a listing of the resource. * * @return Response */ public function index() { return $this->repository->all(); }