public function update(Request $request, $id)
 {
     try {
         $this->service->update($request->all(), $id);
     } catch (\Exception $e) {
         return 'Erro ao realizar atualização: ' . $e->getMessage();
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     try {
         return $this->service->create($request->all());
     } catch (ValidatorException $e) {
         return Response::json(['error' => true, 'message' => $e->getMessageBag()], 400);
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     try {
         return $this->service->update($request->all(), $id);
         //$this->repository->find($id)->update($request->all());
     } catch (ValidatorException $e) {
         Response::json(['error' => true, 'message' => $e->getMessageBag()], 400);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $this->service->destroy($id);
         return response('', 204);
     } catch (\Exception $e) {
         return Response::json(["error" => true, "message" => $e->getMessage()], 400);
     }
 }
 /**
  * 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 = Client::find($id); //consulta dos dados
     
             $client->update($request->all(),$id); //atualiza os dados
     
             return $client; //retornar os dados para serialização em JSON*/
     //return Client::find($id)->update($request->all());
     //return $this->repository->update($request->all(), $id);
     return $this->service->update($request->all(), $id);
 }
Exemplo n.º 6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     //return Client::find($id)->update($request->all());
     //return $this->repository->update($request->all(), $id);
     //return $this->service->update($request->all(), $id);
     try {
         return $this->service->update($request->all(), $id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Não foi possível atualizar o cliente! Cliente não encontrado!'];
     }
 }
 /**
  * Return (download) the file
  * 
  * @param int $id
  * @return Response
  */
 public function getFile($id, $idFile)
 {
     $filename = $this->service->getFilePath($id, $idFile);
     $fileContents = file_get_contents($filename);
     $file = base64_encode($fileContents);
     return ["file" => $file, "mime" => mime_content_type($filename), "size" => filesize($filename), "name" => basename($filename)];
 }
Exemplo n.º 8
0
 /**
  * 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->findOrFail($id);
     if (!is_object($client)) {
         return $client;
     }
     return $this->service->update($request->all(), $id);
 }
Exemplo n.º 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $retorno = $this->service->delete($id);
     if ($retorno === true) {
         return 'Deletado';
     } else {
         return $retorno;
     }
 }
Exemplo n.º 10
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     return $this->service->update($request->all(), $id);
     /*
     $result = $this->repository->find($id)->update($request->all());
     if($result)
         return ['error' => 0];
     return  ['error' => 1, 'msg' => 'Erro ao tentar atualizar o Cliente'];
     */
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->service->delete($id);
 }
Exemplo n.º 12
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     return $this->service->destroy($id);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id, $taskId)
 {
     return $this->service->update($request->all(), $taskId);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->service->destroy($id);
     //Client::find($id)->delete();
 }
Exemplo n.º 15
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $this->service->update($request->all(), $id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     return $this->service->destroy($id);
     return response("", 204);
 }
Exemplo n.º 17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     return $this->service->create($request->all());
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //Client::find($id)->update($request->all());
     return $this->service->update($request->all(), $id);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     return $this->service->update($request->all(), $id);
     //$this->repository->find($id)->update($request->all());
 }