本文整理汇总了PHP中dektrium\user\Finder::findProfileById方法的典型用法代码示例。如果您正苦于以下问题:PHP Finder::findProfileById方法的具体用法?PHP Finder::findProfileById怎么用?PHP Finder::findProfileById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dektrium\user\Finder
的用法示例。
在下文中一共展示了Finder::findProfileById方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionShow
/**
* Shows user's profile.
*
* @param int $id
*
* @return \yii\web\Response
* @throws \yii\web\NotFoundHttpException
*/
public function actionShow($id)
{
$profile = $this->finder->findProfileById($id);
if ($profile === null) {
throw new NotFoundHttpException();
}
return $this->render('show', ['profile' => $profile]);
}
示例2: actionShow
/**
* Shows user's profile.
* @param integer $id
* @return \yii\web\Response
* @throws \yii\web\NotFoundHttpException
*/
public function actionShow($id)
{
$profile = $this->finder->findProfileById($id);
if ($profile === null) {
throw new NotFoundHttpException();
}
$fi = FirmaIngeniero::find()->where(['ingeniero_id' => $profile->user_id])->one();
return $this->render('show', ['profile' => $profile, 'fi' => $fi]);
}
示例3: actionIndex
public function actionIndex()
{
$id = Yii::$app->user->identity->id;
$profile = $this->finder->findProfileById($id);
if ($profile === null) {
throw new NotFoundHttpException();
}
$this->view->params['profile'] = $profile;
return $this->render('index');
}
示例4: actionProfile
/**
* Shows profile settings form.
*
* @return string|\yii\web\Response
*/
public function actionProfile()
{
$model = $this->finder->findProfileById(Yii::$app->user->identity->getId());
$this->performAjaxValidation($model);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', Yii::t('user', 'Your profile has been updated'));
return $this->refresh();
}
return $this->render('profile', ['model' => $model]);
}
示例5: actionShow
/**
* Shows user's profile.
*
* @param int $id
*
* @return \yii\web\Response
* @throws \yii\web\NotFoundHttpException
*/
public function actionShow($id)
{
$profile = $this->finder->findProfileById($id);
$post = Post::getPostByUser($id);
$tags = array();
for ($i = 0; $i < count($post->getModels()); $i++) {
array_push($tags, Post_tags::getTags($post->getModels()[$i]['post_id']));
}
if ($profile === null) {
throw new NotFoundHttpException();
}
return $this->render('show', ['profile' => $profile, 'posts' => $post, 'tags' => $tags]);
}
示例6: actionUpdate
/**
* Updates an existing User model.
* If update is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$user = $this->findModel($id);
$user->scenario = 'update';
$profile = $this->finder->findProfileById($id);
$r = \Yii::$app->request;
$this->performAjaxValidation([$user, $profile]);
if ($user->load($r->post()) && $profile->load($r->post()) && $user->save() && $profile->save()) {
\Yii::$app->getSession()->setFlash('success', \Yii::t('user', 'User has been updated'));
return $this->refresh();
}
return $this->render('update', ['user' => $user, 'profile' => $profile, 'module' => $this->module]);
}
示例7: actionProfile
/**
* Shows profile settings form.
*
* @return string|\yii\web\Response
*/
public function actionProfile()
{
$model = $this->finder->findProfileById(Yii::$app->user->identity->getId());
if ($model == null) {
$model = Yii::createObject(Profile::className());
$model->link('user', Yii::$app->user->identity);
}
$event = $this->getProfileEvent($model);
$this->performAjaxValidation($model);
$this->trigger(self::EVENT_BEFORE_PROFILE_UPDATE, $event);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->getSession()->setFlash('success', Yii::t('user', 'Your profile has been updated'));
$this->trigger(self::EVENT_AFTER_PROFILE_UPDATE, $event);
return $this->refresh();
}
return $this->render('profile', ['model' => $model]);
}