コード例 #1
0
 public function update(Request $request, $id)
 {
     try {
         $this->service->update($request->all(), $id);
     } catch (\Exception $e) {
         return 'Erro ao realizar atualização: ' . $e->getMessage();
     }
 }
コード例 #2
0
 /**
  * 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);
     }
 }
コード例 #3
0
 /**
  * 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);
     }
 }
コード例 #4
0
 /**
  * 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);
     }
 }
コード例 #5
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 = 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);
 }
コード例 #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!'];
     }
 }
コード例 #7
0
 /**
  * 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)];
 }
コード例 #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);
 }
コード例 #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;
     }
 }
コード例 #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'];
     */
 }
コード例 #11
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->service->delete($id);
 }
コード例 #12
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     return $this->service->destroy($id);
 }
コード例 #13
0
 /**
  * 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);
 }
コード例 #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->service->destroy($id);
     //Client::find($id)->delete();
 }
コード例 #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);
 }
コード例 #16
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     return $this->service->destroy($id);
     return response("", 204);
 }
コード例 #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());
 }
コード例 #18
0
 /**
  * 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);
 }
コード例 #19
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);
     //$this->repository->find($id)->update($request->all());
 }