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