當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。