/** * Finds user by username * * @param string $username * @return static|null */ public static function findByUsername($username) { $dbUser = Radiususers::find()->where(["username" => $username, "status" => 1])->one(); if (!count($dbUser)) { return null; } return new static($dbUser); }
/** * Finds the Radiususers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Radiususers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Radiususers::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
<?php use yii\helpers\Html; use yii\grid\GridView; use Yii; use yii\web\IdentityInterface; use app\models\Radiususers; /* @var $this yii\web\View */ /* @var $searchModel app\search\PaymentsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Payments'; $this->params['breadcrumbs'][] = $this->title; if (!Yii::$app->user->isGuest) { $user = Radiususers::findOne(['id' => Yii::$app->user->id]); } ?> <div class="payments-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Create Payments', ['create'], ['class' => 'btn btn-success']); ?> </p>