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


PHP ProjectRepository::create方法代码示例

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


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

示例1: create

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

示例2: create

 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $project = $this->repository->create($data);
         return self::getProject($project->id);
     } catch (ValidatorException $ex) {
         return ['error' => true, 'message' => $ex->getMessageBag()];
     }
 }
开发者ID:paulohsilvestre,项目名称:CodeProject,代码行数:10,代码来源:ProjectServices.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     try {
         return $this->repository->create($request->all());
     } catch (ValidatorException $e) {
         $error = $e->getMessageBag();
         return ['error' => true, 'message' => "Erro ao cadastrar o projeto, alguns campos são obrigatórios!", 'messages' => $error->getMessages()];
     } catch (\Exception $e) {
         return $this->erroMsgm('Ocorreu um erro ao cadastrar o projeto.');
     }
 }
开发者ID:maiconmarioto,项目名称:CodeProject,代码行数:17,代码来源:ProjectOldController.php

示例4: create

 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return response()->json(['error' => true, 'message' => $e->getMessageBag()]);
     }
     //enviar email
     //dispara notificacao
 }
开发者ID:brunowerneck,项目名称:codeproject-curso,代码行数:11,代码来源:ProjectService.php

示例5: update

 public function update(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (ModelNotFoundException $e) {
         return ['error' => true, 'message' => 'Não foi possível atualizar as informações do projeto. Projeto não encontrado.'];
     }
 }
开发者ID:poyastro,项目名称:codeproject-curso,代码行数:11,代码来源:ProjectService.php

示例6: create

 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail();
         $p = $this->repository->create($data);
         if ($p) {
             return "Projeto criado com sucesso!";
         }
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
开发者ID:BrunoDamiao,项目名称:Laravel-5.1,代码行数:12,代码来源:ProjectService.php

示例7: create

 /**
  * @param array $data
  * @return mixed
  */
 public function create(array $data)
 {
     try {
         $data['owner_id'] = \Authorizer::getResourceOwnerId();
         $this->validator->with($data)->passesOrFail();
         return $this->repository->create($data);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     } catch (\Exception $e) {
         return ["error" => true, "message" => $e->getMessage()];
     }
 }
开发者ID:adrianodrix,项目名称:codeproject.dev,代码行数:16,代码来源:ProjectService.php

示例8: create

 /**
  * @param array $data
  * @return \Illuminate\Http\JsonResponse
  */
 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
         $create = $this->repository->create($data);
         $msg = "Projeto criado com sucesso.";
         Log::info($msg);
         return response()->json(["message" => $msg, "data" => $create->toArray()], 200);
     } catch (ValidatorException $e) {
         return response()->json([$e->getMessageBag()], 400);
     }
     //QueryException tratado em Exceptions/Handler.php
 }
开发者ID:renatovaler,项目名称:code-education,代码行数:17,代码来源:ProjectService.php

示例9: create

 public function create(array $data)
 {
     // enviar email
     // disparar notificacao
     // postar tweet
     try {
         $this->validator->with($data)->passesOrFail();
         $project = $this->repository->create($data);
         //Adiciona o owner como membro
         $this->project_member_repository->create(['project_id' => $project['data']['id'], 'user_id' => $project['data']['owner_id']]);
         return $project;
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
开发者ID:phelippe,项目名称:CodeProject,代码行数:15,代码来源:ProjectService.php

示例10: create

 public function create(array $data)
 {
     // diversos serviços
     // enviar email
     // disparar notificacao
     try {
         //dd($data);
         $this->validator->with($data)->passesOrFail();
         $result = $this->repository->create($data);
         //dd($result);
         // adiciona somente um membro ao projeto
         if (!empty($result->id) && !empty($data['user_id'])) {
             $this->addMember(['project_id' => $result->id, 'user_id' => $data['user_id']]);
         }
         return $result;
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
开发者ID:voope,项目名称:CodeProject,代码行数:19,代码来源:ProjectService.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     return $this->repository->create($request->all());
 }
开发者ID:estevesklein,项目名称:CodeProject-curso-laravel,代码行数:10,代码来源:ProjectController.php


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