本文整理匯總了PHP中models\User::findUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::findUser方法的具體用法?PHP User::findUser怎麽用?PHP User::findUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models\User
的用法示例。
在下文中一共展示了User::findUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doView
public function doView()
{
$updateId = CW::$app->request->get('id');
$type = CW::$app->request->get('type');
$categoryName = CW::$app->request->get('category');
$update = \models\Update::getOne($updateId, $type, $categoryName);
if (null !== $update) {
$update['imageUrl'] = Update::getUpdateImageUrl($update['id'], Update::IMAGE_BIG_WIDTH);
$categories = Update::getUpdateCategories($update['id']);
$update['from'] = \models\User::findUser($update['user_id']);
} else {
$categories = [];
}
CW::$app->db->close();
return $this->render('view', ['update' => $update, 'categories' => $categories, 'categoryName' => $categoryName, 'prevUpdateId' => null === $update ? null : Update::getPrev($updateId, $categoryName), 'nextUpdateId' => null === $update ? null : Update::getNext($updateId, $categoryName)]);
}
示例2: updateSettings
private function updateSettings()
{
$user = \models\User::findUser(CW::$app->user->identity->id);
$form = new \models\forms\EditProfileForm();
$form->userCategories = $user->categories;
$form->userId = $user->id;
if (empty(CW::$app->request->post())) {
$form->username = $user->username;
$form->description = $user->description;
$success = false;
} else {
if ($form->load(CW::$app->request->post()) && $form->save()) {
$_SESSION['user']->username = $form->username;
$success = true;
}
}
$categories = \models\Category::getAllCategories();
return ['model' => $form, 'success' => $success, 'categories' => $categories];
}