public static function count($id) { return Query::find()->where(['author_id' => Yii::$app->user->id])->where(['query_id' => $id])->count(); }
?> <?php echo $form->field($model, 'address'); ?> <?php echo $form->field($model, 'show_on_map'); ?> <?php echo $form->field($model, 'html'); ?> <?php echo $form->field($model, 'query_id')->dropDownList(\yii\helpers\ArrayHelper::map(\app\models\Query::find()->all(), 'id', 'name')); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
public static function takeAll() { $query = Query::find(); return $query->where(['author_id' => Yii::$app->user->isGuest ? 0 : Yii::$app->user->id])->all(); }