/** * @requireMinimumStatus * used two lines for if statement to avoid word wrapping * @param mixed $status_name */ public static function requireMinimumStatus($status_name) { if (Yii::$app->user->identity->status_id >= ValueHelpers::getStatusValue($status_name)) { return true; } else { return false; } }
public function loginAdmin() { if ($this->validate() && $this->getUser()->role_id >= ValueHelpers::getRoleValue('Admin') && $this->getUser()->status_id == ValueHelpers::getStatusValue('Active')) { return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); } else { throw new NotFoundHttpException('You Shall Not Pass.'); } }