/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Customsoffice::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'customs_officec', $this->customs_officec]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getCustomsOffice() { return $this->hasOne(Customsoffice::className(), ['id' => 'customs_office_id']); }
/** * Finds the Customsoffice model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Customsoffice the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Customsoffice::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/* @var $searchModel backend\modules\configuration\models\CustomsSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'ด่านศุลกากร'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="customs-index"> <div class="box"> <div class="box-header"> <p> <?php echo Html::a('เพิ่ม ด่านศุลกากร', ['create'], ['class' => 'btn btn-success pull-right']); ?> </p> </div><!-- /.box-header --> <div class="box-body table-responsive"> <div class="state-index"> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'kartik\\grid\\SerialColumn'], ['attribute' => 'customs_office_id', 'width' => '150px', 'value' => function ($model, $key, $index, $widget) { return $model->customsOffice->customs_officec; }, 'filterType' => GridView::FILTER_SELECT2, 'filter' => ArrayHelper::map(Customsoffice::find()->orderBy('id')->asArray()->all(), 'id', 'customs_officec'), 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true]], 'filterInputOptions' => ['placeholder' => 'สำนักงาน'], 'group' => true], 'customs_name', 'customs_prv', 'customs_amp', ['class' => 'yii\\grid\\ActionColumn']]]); ?> </div> </div> </div> </div>
</span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <!---Start Second Row Display Configuration---> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-light-blue-active"><i class="fa fa-university"></i></span> <div class="edusec-link-box-content"> <span class="edusec-link-box-text"><?php echo Html::a('สำนัก/ด่านศุลกากร', ['/configuration/customs-office/index']); ?> </span> <span class="edusec-link-box-number"><?php echo Customsoffice::find()->count(); ?> </span> <span class="edusec-link-box-desc">สำนัก/ด่านศุลกากร</span> <span class="edusec-link-box-bottom"><?php echo Html::a('<i class="fa fa-plus-square"></i> Create New', ['/configuration/customs-office/create']); ?> </span> </div><!-- /.info-box-content --> </div><!-- /.info-box --> </div> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="edusec-link-box"> <span class="edusec-link-box-icon bg-light-blue-active"><i class="fa fa-language"></i></span> <div class="edusec-link-box-content">