本文整理汇总了PHP中backend\models\User::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getUser方法的具体用法?PHP User::getUser怎么用?PHP User::getUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backend\models\User
的用法示例。
在下文中一共展示了User::getUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeAction
public function beforeAction($action)
{
if (!$this->isLogin()) {
$this->layout = false;
return $this->redirect("/admin/login");
//用户未登录自动跳转至登录页
}
$user = new User();
$user->setUser(\Yii::$app->session->get(USER_SESSION));
\Yii::$app->view->params['user'] = $user->getUser();
// 当前用户
$this->user = $user;
$this->isCan();
//权限验证
$this->assign('currentUserRole', $user->getUser()['role']);
$this->assign('currentUserId', $user->getUser()['id']);
return parent::beforeAction($action);
// TODO: Change the autogenerated stub
}
示例2: beforeSave
public function beforeSave($insert)
{
if (parent::beforeSave($insert)) {
if ($this->isNewRecord) {
} else {
}
// $this->_oldTag = $this->tag;
$this->user_by = \Yii::$app->user->identity->nama_depan;
$this->schedule_date = date('Y-m-d H:i:s', strtotime(str_replace("-", "", $this->schedule_date)));
isset($this->author) ? $this->author_name = User::getUser($this->author)->nama_depan : ($this->author_name = NUll);
isset($this->categori_id) ? $this->categori_name = Category::getCateory($this->categori_id)->nama : ($this->categori_name = NUll);
return true;
} else {
return false;
}
}