当前位置: 首页>>代码示例>>PHP>>正文


PHP ProjectRepository::find方法代码示例

本文整理汇总了PHP中CodeProject\Repositories\ProjectRepository::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectRepository::find方法的具体用法?PHP ProjectRepository::find怎么用?PHP ProjectRepository::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CodeProject\Repositories\ProjectRepository的用法示例。


在下文中一共展示了ProjectRepository::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $p = $this->repository->find($id)->delete();
     if ($p) {
         return "O projeto {$id} foi deletado com sucesso!";
     }
 }
开发者ID:BrunoDamiao,项目名称:Laravel-5.1,代码行数:13,代码来源:ProjectController.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     if ($this->checkProjectPermissions($id) == false) {
         return ['error' => 'Access Forbiden'];
     }
     return $this->repository->find($id);
 }
开发者ID:eduovrp,项目名称:laravel-com-angularjs,代码行数:13,代码来源:ProjectController.php

示例3: show

 /**
  * 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 ['error' => true, 'message' => 'Project not Found'];
     }
 }
开发者ID:adanfm,项目名称:code-project,代码行数:14,代码来源:ProjectController.php

示例4: isMember

 public function isMember($project_id, $member_id)
 {
     $project = $this->repository->find($project_id)->members()->find(['member_id' => $member_id]);
     if (count($project)) {
         return true;
     }
     return false;
 }
开发者ID:henriesteves,项目名称:CodeProject,代码行数:8,代码来源:ProjectService.php

示例5: delete

 public function delete($id)
 {
     try {
         $this->repository->find($id)->delete();
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
开发者ID:netoudi,项目名称:laravel-angularjs,代码行数:8,代码来源:ProjectService.php

示例6: find

 public function find($id)
 {
     try {
         return $this->repository->find($id);
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Projeto não encontrado'];
     }
 }
开发者ID:poyastro,项目名称:codeproject-curso,代码行数:8,代码来源:ProjectService.php

示例7: show

 public function show($id)
 {
     try {
         $rtrn = $this->repository->find($id);
         return $rtrn;
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Projeto não existe'];
     }
 }
开发者ID:phelippe,项目名称:CodeProject,代码行数:9,代码来源:ProjectService.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //if($this->checkProjectPermissions($id) == false){
     if ($this->service->checkProjectPermissions($id) == false) {
         return ['error' => 'Access Forbidden'];
     }
     //return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]);
     return $this->repository->find($id);
     //return $this->repository->with(['client', 'user'])->find($id);
 }
开发者ID:estevesklein,项目名称:CodeProject-curso-laravel,代码行数:16,代码来源:ProjectController.php

示例9: destroy

 public function destroy($id)
 {
     try {
         $project = $this->repository->find($id);
         $project->delete();
         $msg['status'] = "Y";
         $msg['message'] = "Successfully deleted record";
         return $msg;
     } catch (ValidatorException $ex) {
         return ['error' => true, 'message' => $ex->getMessageBag()];
     }
 }
开发者ID:paulohsilvestre,项目名称:CodeProject,代码行数:12,代码来源:ProjectServices.php

示例10: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     /*$userId = \Authorizer::getResourceOwnerId();
       if($this->repository->isOwner($id, $userId) == false){
           return ['success'=>false];
       }*/
     if ($this->checkProjectPermissions($id) == false) {
         return ['error' => 'Access Forbidden'];
     }
     return $this->repository->find($id);
     //return Client::find($id);
 }
开发者ID:EltonSouza,项目名称:laravel-com-angular2,代码行数:18,代码来源:ProjectController.php

示例11: destroy

 public function destroy($id)
 {
     try {
         if ($this->repository->find($id)->destroy()) {
             return ['error' => false, 'message' => 'Projeto deletado.'];
         }
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Projeto não encontrado.'];
     } catch (\PDOException $e) {
         return ['success' => false, 'message' => 'Existem projetos cadastrados a este cliente!'];
     }
 }
开发者ID:Julianocs,项目名称:codeproject_curso,代码行数:12,代码来源:ProjectService.php

示例12: update

 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $P = $this->repository->find($id)->update($data);
         if ($P) {
             // return "O projeto '".$data['name']."', foi editado com sucesso!";
             return ['error' => false, 'message' => "O projeto '" . $data['name'] . "', foi editado com sucesso!"];
         }
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
开发者ID:BrunoDamiao,项目名称:Laravel-5.1,代码行数:13,代码来源:ProjectService.php

示例13: create

 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $user_id = \Authorizer::getResourceOwnerId();
         if ($data['owner_id'] != $user_id) {
             return Errors::basic('Voce nao pode inserir um novo projeto cujo dono nao seja voce.');
         }
         $project = Project::create($data);
         $resp = $this->projectMemberService->create(['project_id' => $project->id, 'user_id' => $data['owner_id']]);
         return $this->repository->find($project->id);
     } catch (ValidatorException $e) {
         return Errors::basic($e->getMessageBag());
     }
 }
开发者ID:nelioalves,项目名称:curso-modulo-angular,代码行数:15,代码来源:ProjectService.php

示例14: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     if ($this->isNotOwner($id) and $this->isNotMember($id)) {
         return ['error' => 'Access forbirdden'];
     }
     $this->repository->find($id)->delete($id);
 }
开发者ID:LucasFCastro,项目名称:codeproject,代码行数:13,代码来源:ProjectController.php

示例15: create

 public function create($projectId, $file, array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $data['extension'] = $file->getClientOriginalExtension();
         $data['file'] = md5(date('Y-m-d H:i:s')) . "." . $data['extension'];
         $this->storage->put($data['file'], $this->filesystem->get($file));
         $project = $this->projectRepository->find($projectId);
         $file = $project->files()->create($data);
         return $this->find($projectId, $file->id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ['error' => true, 'message' => $e->getMessage()];
     }
 }
开发者ID:netoudi,项目名称:laravel-angularjs,代码行数:16,代码来源:ProjectFileService.php


注:本文中的CodeProject\Repositories\ProjectRepository::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。