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


PHP Project::find方法代码示例

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


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

示例1: invitation

 public function invitation($code)
 {
     if (Auth::check()) {
         $string = base64_decode($code);
         $ary = explode('-', $string);
         $email = $ary[0];
         $pId = $ary[1];
         $user = User::where('email', $email)->first();
         if ($user) {
             $user = $user->toArray();
             if (Auth::check()) {
                 if (Auth::user()->email == $user['email']) {
                     ProjectUser::where('project_id', $pId)->where('user_id', $user['id'])->update(['invitation' => 1]);
                     $project = Project::find($pId)->toArray();
                     $message = 'You are now member of project ' . $project['name'];
                     return Response()->json(ResponseManager::getResult($ary, 10, $message));
                 } else {
                     Auth::logout();
                     Session::flush();
                     $message = 'Please login with the email id on which you receive the invitation.';
                     return Response()->json(ResponseManager::getError('', 101, $message));
                 }
             } else {
                 $message = 'Plese login to accept the invitation';
                 return Response()->json(ResponseManager::getError('', 1010, $message));
             }
         } else {
             $message = 'You are not register with us. Please register with us.';
             return Response()->json(ResponseManager::getError('', 2020, $message));
         }
     } else {
         $message = 'Plese login to accept the invitation';
         return Response()->json(ResponseManager::getError('', 10, $message));
     }
 }
开发者ID:maineventio,项目名称:newprojectbase,代码行数:35,代码来源:CommonController.php

示例2: actionSettings

 public function actionSettings($identifier)
 {
     $model = Project::find()->identifier($identifier)->one();
     if ($model->load(Yii::$app->request->post())) {
         // store the current logo
         $old_logo = $model->logo;
         $image = UploadedFile::getInstance($model, 'image');
         if (!is_null($image)) {
             // store the source file name
             $model->logoname = $image->name;
             $ext = end(explode(".", $image->name));
             // generate a unique file name
             $model->logo = Yii::$app->security->generateRandomString() . ".{$ext}";
             $path = Yii::$app->basePath . '/web/uploads/' . $model->logo;
         }
         if ($model->save()) {
             if (!is_null($image)) {
                 // save the new logo
                 $image->saveAs($path);
                 // get rid of the old logo
                 unlink(Yii::$app->basePath . '/web/uploads/' . $old_logo);
             }
             return $this->render('settings', ['model' => $model]);
         } else {
             Yii::$app->getSession()->setFlash('danger', Yii::t('app', 'Something went wrong and the settings was not saved.'));
         }
     } else {
         return $this->render('settings', ['model' => $model]);
     }
 }
开发者ID:jacmoe,项目名称:bugitor,代码行数:30,代码来源:ProjectController.php

示例3: store

 public function store($project_id, $request)
 {
     $section = new Section();
     $section->fill($request);
     $project = Project::find($project_id);
     $project->sections()->save($section);
     return $section;
 }
开发者ID:ronal2do,项目名称:dave_brubeck,代码行数:8,代码来源:SectionRepository.php

示例4: edit

 /**
  * Show the form for editing the specified resource.
  * GET /tasks/{id}/edit
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($society, $project, $id)
 {
     $data['society'] = $society;
     $data['task'] = Task::find($id);
     $data['project'] = Project::find($data['task']->project_id);
     $data['individuals'] = Individual::all();
     return View::make('tasks.edit', $data);
 }
开发者ID:bishopm,项目名称:circuit,代码行数:15,代码来源:TasksController.php

示例5: findModel

 protected function findModel($id)
 {
     $model = Project::find()->andFilterWhere(['OR', ['=', 'user_id', Yii::$app->user->id], ['=', 'executor_id', Yii::$app->user->id]])->andFilterWhere(['id' => $id])->one();
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
开发者ID:defektrain,项目名称:sgm-rest,代码行数:9,代码来源:ProjectController.php

示例6: addCommentToProject

 public function addCommentToProject($id, array $input)
 {
     $project = Project::find($id);
     $mainComment = new Comment();
     $mainComment->fill($input);
     $project->comments()->save($mainComment);
     $this->linkToCurrentUser($mainComment);
     return $mainComment;
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:9,代码来源:CommentProjectService.php

示例7: actionIndex

 public function actionIndex()
 {
     if (Yii::$app->user->isGuest) {
         return $this->render('index');
     } else {
         $projects = Project::find()->byOwner(\Yii::$app->user->identity->id)->all();
         return $this->render('dashboard', ['projects' => $projects]);
     }
 }
开发者ID:jacmoe,项目名称:bugitor,代码行数:9,代码来源:SiteController.php

示例8: actionReports

 /**
  * Главный экшн для клиента это отчеты которые пришли от менеджера
  * Проверен (21.12.15)
  */
 public function actionReports()
 {
     //Сессия необходима для создания временного файла для хранения картинок до создания товара
     $session = new Session();
     $session->open();
     //cs - CREATE SESSION ID
     $session['cs_' . Yii::$app->user->identity->id] = md5(time() . rand(0, 10000));
     $projects = Project::find()->where(['for_user_id' => Yii::$app->user->identity->id])->all();
     return $this->render('reports', compact('projects'));
 }
开发者ID:Sheriyev,项目名称:G5-CRM,代码行数:14,代码来源:ClientController.php

示例9: addComment

 public function addComment($projectId)
 {
     $user = \Auth::user();
     $comment = new Comment();
     $comment->comment = \Input::get("comment");
     $project = Project::find($projectId);
     $project->comments()->save($comment);
     $comment->createdBy()->save($user);
     return redirect("/users/project/{$projectId}");
 }
开发者ID:clubttt,项目名称:SuccessModel4,代码行数:10,代码来源:UserController.php

示例10: actionIndex

 /**
  * 配置项目列表
  *
  */
 public function actionIndex()
 {
     $project = Project::find()->where(['user_id' => $this->uid]);
     $kw = \Yii::$app->request->post('kw');
     if ($kw) {
         $project->andWhere(['like', "name", $kw]);
     }
     $project = $project->asArray()->all();
     return $this->render('index', ['list' => $project]);
 }
开发者ID:richardfan,项目名称:walle-web,代码行数:14,代码来源:ConfController.php

示例11: actionIndex

 /**
  * 配置项目列表
  *
  */
 public function actionIndex()
 {
     // 显示该用户为管理员的所有项目
     $project = Project::find()->leftJoin(Group::tableName(), '`group`.`project_id`=`project`.`id`')->where(['`group`.`user_id`' => $this->uid, '`group`.`type`' => Group::TYPE_ADMIN]);
     $kw = \Yii::$app->request->post('kw');
     if ($kw) {
         $project->andWhere(['like', "name", $kw]);
     }
     $project = $project->asArray()->all();
     return $this->render('index', ['list' => $project]);
 }
开发者ID:ashehui,项目名称:walle-web,代码行数:15,代码来源:ConfController.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Project::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'is_public' => $this->is_public, 'status_id' => $this->status_id, 'creator_id' => $this->creator_id, 'created_date' => $this->created_date, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
开发者ID:mops1k,项目名称:yiimine,代码行数:18,代码来源:ProjectSearch.php

示例13: actionCategory

 public function actionCategory($url = null)
 {
     $query = Project::find();
     $addition = Project::find()->select('id')->orderBy('id ASC')->limit(3)->asArray()->all();
     if (!is_null($url)) {
         $query->innerJoinWith('category', 'category_id = category_id')->where(['url' => $url]);
     }
     $dataProvider = new \yii\data\ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 9]]);
     $projectModel = Project::find()->joinWith('category', 'category.category_id = project.category_id')->orderBy('id ASC')->limit(3)->all();
     return $this->render('category', ['dataProvider' => $dataProvider, 'categoryModel' => Category::find()->all(), 'customerModel' => Customer::find()->all(), 'projectModel' => $projectModel]);
 }
开发者ID:phamviet1510,项目名称:daitech-web,代码行数:11,代码来源:ExperienceController.php

示例14: actionIndex

 public function actionIndex()
 {
     $model = new Messenger();
     $projectResult = Project::find()->all();
     if ($model->load(Yii::$app->request->post())) {
         $model->read_chk = 0;
         $model->del_chk = 0;
         $model->date = date("Y/m/d H:i:s");
         $model->save();
     }
     return $this->render('index', ['model' => $model, 'projectResult' => $projectResult]);
 }
开发者ID:absol3112,项目名称:diary,代码行数:12,代码来源:SiteController.php

示例15: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($user, $project_name, Request $request)
 {
     $project_id = $request->query('id');
     $project = Project::find($project_id);
     if (is_null($project)) {
         $project = Session::get('project');
     }
     $stories = Story::where('project_id', $project->id)->get();
     $count = $stories->count();
     $points = $stories->sum('story_point');
     return view('user.project.show', compact('project', 'project_name', 'user', 'project_id', 'stories', 'points', 'count'));
 }
开发者ID:sparkan,项目名称:Sparkous,代码行数:18,代码来源:ProjectController.php


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