本文整理汇总了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));
}
}
示例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]);
}
}
示例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;
}
示例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);
}
示例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.');
}
}
示例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;
}
示例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]);
}
}
示例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'));
}
示例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}");
}
示例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]);
}
示例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]);
}
示例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;
}
示例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]);
}
示例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]);
}
示例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'));
}