$subnetQuery = Subnet::find();
$subnetQuery->andWhere(['bras' => 2]);
$clientQuery = Clint::find();
$clientQuery->andWehere(['in', 'subnet', $subnetQuery]);
//
$clientQuery->all();
//
$clientQuery->limit(1);
$clientQuery->one();
$form = new ContactForm();
$form->tel = $user->tel;
$id = Yii::$app->user->identity->id;
$user = ContactForm::find()->where(['user_id' => $id])->one();
$form = new ContactForm($user);
if ($form->load(Yii::$app->request->post()) && $form->validate() && $form->save()) {
return $this->refresh();
}else{
return $this->render('profile', compact('form', 'user'));
}
<?= $form->field($model, 'category_id')->dropDownList(['' => 'Укажите отделение'] + ArrayHelper::map(Category::find()->all(), 'id','name'),['style'=>'font-family: \'Exo 2\', sans-serif; color: #0f0f0f; font-size:17px'])->label('Отделение')?>
$query = Product::find();
$query->select(['category_id', 'count' => 'count(`id`)']);
$query->visible();
$query->andWhere(['category_id' => $categoryIds]);
$query->groupBy('category_id');
$query->asArray();
if($_POST) {
header('content-type: text/html; charset=utf-8');
echo '<pre>';
@print_r($model);
echo '</pre>';
exit(__FILE__ . ': ' . __LINE__);
}
->where(['status' => '1'])->andWhere(['in', 'category_id', $categoryIds])
if (Yii::$app->request->isAjax && Yii::$app->request->isPost) {
$carddoc = Yii::$app->request->post('a');
$cards = Cards::find()->where(['doctor_id' => $id, 'data' => $carddoc])->asArray()->all();
return $this->asJson($cards);
}
'assetManager' => [
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'sourcePath' => null,
'css' => [
'//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css',
]
],
],
],
// найти покупателей и получить их вместе с их странами и активными заказами
// SELECT * FROM `customer`
// SELECT * FROM `country` WHERE `id` IN (...)
// SELECT * FROM `order` WHERE `customer_id` IN (...) AND `status` = 1
$customers = Customer::find()->with([
'country',
'orders' => function ($query) {
$query->andWhere(['status' => Order::STATUS_ACTIVE]);
},
])->all();