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