public static function getShippings() { $shippings = \Yii::$app->cache->get('shippings'); if ($shippings === false) { $shippings = ShippingModel::find()->all(); \Yii::$app->cache->add('shippings', $shippings); } return $shippings; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ShippingModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'systemName', $this->systemName])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
?> <?php echo $form->field($model, 'totalPrice')->textInput(['maxlength' => 10]); ?> <?php echo $form->field($model, 'date')->textInput(); ?> <?php echo $form->field($model, 'idPayment')->dropDownList(ArrayHelper::map(PaymentModel::find()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'idShipping')->dropDownList(ArrayHelper::map(ShippingModel::find()->all(), 'id', 'name')); ?> <?php echo $form->field($model, 'paymentStatus')->textInput(); ?> <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(); ?>