コード例 #1
0
ファイル: ClientService.php プロジェクト: mvnp/Projeto
 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $this->repository->update($data, $id);
         return $this->repository->find($id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
コード例 #2
0
ファイル: ClientController.php プロジェクト: mvnp/Projeto
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $this->repository->find($id)->delete();
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
コード例 #3
0
ファイル: ClientController.php プロジェクト: andcarpi/projeto
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $this->repository->find($id)->delete($id);
 }