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


PHP Repositories\ProjectRepository类代码示例

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


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

示例1: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     if (!$this->checkProjectPermissions($id)) {
         return ['error' => 'Access forbidden'];
     }
     return $this->repository->find($id);
 }
开发者ID:nativadesenvolvimento,项目名称:codeproject_curso,代码行数:13,代码来源:ProjectFileController.php

示例2: 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

示例3: createFile

 public function createFile(array $data)
 {
     $project = $this->repository->skipPresenter()->find($data['project_id']);
     //dd($project);
     $projectFile = $project->files()->create($data);
     $this->storage->put($projectFile->id . "." . $data['extension'], $this->filesystem->get($data['file']));
 }
开发者ID:EltonSouza,项目名称:laravel-com-angular2,代码行数:7,代码来源:ProjectService.php

示例4: createFile

 public function createFile(array $data)
 {
     $project = $this->repository->skipPresenter()->find($data['project_id']);
     $projectFile = $project->files()->create($data);
     $arquivo = $projectFile->id . "." . $data['extension'];
     \Storage::put($arquivo, \File::get($data['file']));
 }
开发者ID:danillosrangel,项目名称:CodeProject-curso,代码行数:7,代码来源:ProjectService.php

示例5: delete

 public function delete($id)
 {
     try {
         $this->repository->delete($id);
     } catch (ModelNotFoundException $e) {
         return response()->json(['error' => true, 'message' => "Project id {$id} not found"]);
     }
 }
开发者ID:brunowerneck,项目名称:codeproject-curso,代码行数:8,代码来源:ProjectService.php

示例6: destroy

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

示例7: update

 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->update($data, $id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
开发者ID:Gabriel-aa,项目名称:curso-laravel,代码行数:9,代码来源:ProjectTaskService.php

示例8: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     if ($this->repository->isOwner($projectId, $userId) == false) {
         return ['success' => false, 'userId' => 'Forbidden'];
     }
     return $next($request);
 }
开发者ID:tiagocardosos,项目名称:laravel-codeeducation,代码行数:16,代码来源:CheckProjectOwner.php

示例9: checkProjectPermissions

 private function checkProjectPermissions($projectId)
 {
     $this->repository->skipPresenter(true);
     if ($this->checkProjectOwner($projectId) or $this->checkProjectMember($projectId)) {
         $this->repository->skipPresenter(false);
         return true;
     }
     return false;
 }
开发者ID:90lucasgabriel,项目名称:activity,代码行数:9,代码来源:ProjectController.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = Authorizer::getResourceOwnerId();
     $projectId = $request->projects;
     if (!$this->repository->isOwner($projectId, $userId)) {
         return ['error' => 'Access forbidden'];
     }
     return $next($request);
 }
开发者ID:nativadesenvolvimento,项目名称:codeproject_curso,代码行数:16,代码来源:CheckProjectOwner.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = Authorizer::getResourceOwnerId();
     $projectId = $request->project;
     if ($this->repository->isOwner($projectId, $userId) == false) {
         return ['error' => 'Access Denied!'];
     }
     return $next($request);
 }
开发者ID:hugosv,项目名称:codeproject-curso,代码行数:16,代码来源:CheckProjectOwner.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->projects;
     if ($this->repository->isOwner($projectId, $userId) == false) {
         return ['error' => 'Access denied! You must be the project owner to access this resource'];
     }
     return $next($request);
 }
开发者ID:emersonrodrigod,项目名称:codeproject,代码行数:16,代码来源:CheckProjectOwner.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $userId = \Authorizer::getResourceOwnerId();
     $projectId = $request->id;
     if ($this->repository->isOwner($projectId, $userId) == false) {
         return ['error' => true, 'message' => 'Access forbidden'];
     }
     return $next($request);
 }
开发者ID:sobreirami,项目名称:Codeproject,代码行数:16,代码来源:CheckProjectOwner.php

示例14: removeMember

 public function removeMember($projectId, $memberId)
 {
     try {
         $result = $this->projectRepository->removeMember($projectId, $memberId);
         return ['success' => $result, "message" => 'Remover membro do projeto.'];
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Falha ao remover membro do projeto.', "messageDev" => $e->getMessage()];
     }
 }
开发者ID:jonasleitep4,项目名称:curso-laravel-angular,代码行数:9,代码来源:ProjectMemberService.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $user_id = \Authorizer::getResourceOwnerId();
     $project_id = $request->project;
     $projects = $this->repository->skipPresenter()->findWhere(['id' => $project_id, 'owner_id' => $user_id]);
     if (count($projects) == false) {
         return ['error' => 'Access forbidden'];
     }
     return $next($request);
 }
开发者ID:phelippe,项目名称:CodeProject,代码行数:17,代码来源:CheckProjectOwner.php


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