/**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $c = $this->repository->find($id)->delete();
     if ($c) {
         return "O projeto {$id} foi deletado com sucesso!";
     }
 }
 public function find($id)
 {
     if (is_null(Client::find($id))) {
         return Errors::invalidId($id);
     }
     return $this->repository->find($id);
 }
 /**
  * Find a client
  * @param  integer $id client id
  * @return json
  */
 public function find($id)
 {
     try {
         return $this->repository->find($id);
     } catch (\Exception $e) {
         return ["error" => true, "message" => $e->getMessage()];
     }
 }
 public function show($id)
 {
     try {
         return $this->repository->find($id);
     } catch (Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
 public function show($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Usuario nao existe'];
     }
 }
 public function delete($id)
 {
     try {
         $this->repository->find($id)->delete();
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
 public function find($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Cliente não encontrado'];
     }
 }
 /**
  * @param $id
  * @return \Illuminate\Http\JsonResponse|mixed
  */
 public function show($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ModelNotFoundException $e) {
         return response()->json([$e->getMessage()], 404);
     }
     //QueryException tratado em Exceptions/Handler.php
 }
 public function show($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ValidatorException $e) {
         return response()->json(['error' => true, 'message' => $e->getMessageBag()]);
     } catch (ModelNotFoundException $e) {
         return response()->json(['error' => true, 'message1' => $e->getMessage(), 'message2' => 'Cliente ID ' . $id . ' nao encontrado.']);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ModelNotFoundException $e) {
         return $this->erroMsgm('Cliente não encontrado.');
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao exibir o cliente.');
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $client = $this->repository->find($id);
     if ($client) {
         $client->delete();
         $msg['status'] = "Y";
         $msg['message'] = "Successfully deleted record";
     } else {
         $msg['status'] = "N";
         $msg['message'] = "record already deleted or invalid";
     }
     return $msg;
 }
 /**
  * Delete the client
  *
  * @param  integer $id   client id
  * @return json
  */
 public function delete($id)
 {
     try {
         $this->repository->find($id)->projects()->delete();
         $this->repository->delete($id);
         return ['success' => true];
     } catch (\Exception $e) {
         return ["error" => true, "message" => $e->getMessage()];
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $client = $this->repository->find($id);
     return $this->service->update($request->all(), $id);
 }
 public function destroy($id)
 {
     $this->repository->find($id)->delete();
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id, $taskId)
 {
     return $this->repository->find($taskId);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return $this->repository->find($id);
     //return Client::find($id);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $res = $this->repository->find($id);
     return $res['data'];
 }