本文整理汇总了PHP中app\modules\user\models\User::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getById方法的具体用法?PHP User::getById怎么用?PHP User::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\modules\user\models\User
的用法示例。
在下文中一共展示了User::getById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
/**
* Lists all Products models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ProductsSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
$countries = Countries::find()->all();
$userId = Yii::$app->user->getId();
$userModel = User::getById($userId);
return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'countries' => $countries, 'userModel' => $userModel]);
}
示例2: getWholesalePriceWithoutNds
public function getWholesalePriceWithoutNds()
{
$userId = Yii::$app->user->getId();
$userModel = User::getById($userId);
$price = Products::findOne(['kodpart' => $this->kodpart, 'otd' => $this->otd, 'namepr' => $this->dsv]);
if (isset($price)) {
if ($userModel->isCenDogovor()) {
$price->cenopt = $price->cendogovor;
}
return $price->cenopt;
} else {
return null;
}
}
示例3: function
}, 'format' => 'html'], ['label' => 'Год тендера', 'value' => function ($model, $key, $index, $column) {
$product = app\modules\main\models\Products::findOne(['kodpart' => $model->kodpart]);
if (isset($product)) {
return $product->tendergod;
} else {
return '-';
}
}, 'format' => 'html'], ['label' => 'Отдел склада', 'value' => function ($model, $key, $index, $column) {
return $model->otd;
}, 'format' => 'html'], ['label' => 'Заказанное количество', 'value' => function ($model, $key, $index, $column) {
return $model->kolz;
}, 'format' => 'html'], ['label' => 'Стоимость, руб', 'value' => function ($model, $key, $index, $column) {
$product = app\modules\main\models\Products::findOne(['kodpart' => $model->kodpart]);
if (isset($product)) {
$userId = Yii::$app->user->getId();
$userModel = User::getById($userId);
if ($userModel->isCenDogovor()) {
$cena = $product->cendogovor;
} else {
$cena = $product->cenopt;
}
return number_format($cena * $model->kolz, 2, ' руб ', ' ') . 'коп';
} else {
return '<span class="label label-danger">-</span>';
}
}, 'format' => 'html'], ['label' => 'Ставка НДС, %', 'value' => function ($model, $key, $index, $column) {
$product = app\modules\main\models\Products::findOne(['kodpart' => $model->kodpart]);
if (isset($product)) {
return $product->nds;
} else {
return '<span class="label label-danger">-</span>';