本文整理汇总了PHP中common\models\User::findByUsername1方法的典型用法代码示例。如果您正苦于以下问题:PHP User::findByUsername1方法的具体用法?PHP User::findByUsername1怎么用?PHP User::findByUsername1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common\models\User
的用法示例。
在下文中一共展示了User::findByUsername1方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUser
/**
* Finds user by [[username]]
*
* @return User|null
*/
public function getUser()
{
if ($this->_user === false) {
$this->_user = User::findByUsername1($this->username);
}
return $this->_user;
}
示例2: signup
/**
* Signs user up.
*
* @return User|null the saved model or null if saving fails
*/
public function signup()
{
if ($this->validate()) {
$query2 = (new Query())->select('username')->from('user')->where('city=:city AND dealer=:deal', array(':city' => $this->city, ':deal' => 1));
$dealer = $query2->all();
$flag = 1;
$car = $this->model_name;
$use = new User();
$user = Yii::$app->user->identity->username;
$val = $use->findByUsername($user);
$color = $this->color;
$variant = $this->variant;
$city = $this->city;
$otherr = $this->otherr;
$delivery = $this->delivery;
$urequest = new Userrequest();
$urequest->car_model = $car;
$urequest->user_id = $val->id;
$urequest->username = $val->username;
$urequest->color = $color;
$urequest->variant = $variant;
$urequest->city = $city;
$urequest->otherr = $otherr;
$urequest->delivery = $delivery;
$urequest->save();
\Yii::$app->mailer->compose(['html' => 'request-html'], ['user' => $val, 'req' => $urequest])->setFrom([\Yii::$app->params['supportEmail'] => 'motormetric' . ' robot'])->setTo($val->email)->setSubject('Your Request ' . $urequest->car_model)->send();
foreach ($dealer as $deal) {
$request = new Carrequest();
$val1 = $use->findByUsername1($deal['username']);
$request->car_model = $car;
$request->user_id = $val->id;
$request->user_name = $val->username;
$request->dealer_name = $deal['username'];
$request->color = $color;
$request->variant = $variant;
$request->city = $city;
$request->dealer_id = $val1->id;
$request->request_id = $urequest->id;
$request->otherr = $urequest->otherr;
\Yii::$app->mailer->compose(['html' => 'requestd-html'], ['user' => $val, 'req' => $urequest, 'deal' => $val1])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])->setTo($val1->email)->setSubject('New Request ' . $urequest->car_model)->send();
if (!$request->save()) {
$flag = 0;
}
}
if ($flag) {
$request = new Carrequest();
return $request;
}
return null;
//$user->username = $this->username;
}
}
示例3: actionFeedback
public function actionFeedback()
{
$feed = new Feedbackform();
$use = new User();
$user = Yii::$app->user->identity->username;
$val = $use->findByUsername1($user);
if ($feed->load(Yii::$app->request->post())) {
return $this->render('dash', ['quote' => $quote]);
}
return $this->render('feedback', ['feed' => $feed]);
}
示例4: User
use yii\grid\GridView;
use yii\bootstrap\ActiveForm;
use frontend\models\Car;
use frontend\models\Carrequest;
use yii\helpers\ArrayHelper;
use common\models\User;
use yii\db\Query;
use yii\bootstrap\Modal;
use frontend\models\Dealerreply;
use frontend\models\Reply;
use frontend\models\Userrequest;
use yii\data\ActiveDataProvider;
use yii\helpers\Url;
$user = Yii::$app->user->identity->username;
$use = new User();
$val = $use->findByUsername1($user);
$rows = Userrequest::find()->where('user_id=:user_id', array(':user_id' => $val->id))->all();
?>
<div class="site-index" style="margin-top: 5%; margin-bottom: 5%;">
<?php
echo Html::a('DASHBOARD', ['/controller/action'], ['class' => 'btn btn-primary4']);
?>
<?php
echo Html::button('ADD CAR', ['value' => Url::to(['/site/addcar']), 'class' => 'btn btn-primary4', 'id' => 'modalbutton']);
?>
<?php
echo Html::a('VIEW ARCHIVE ', ['/controller/action'], ['class' => 'btn btn-primary4']);
?>
<?php