嗯嗯
- 嗯嗯 发表了说说下班回家打dota
- 嗯嗯 发表了说说我教你
- 嗯嗯 2017-03-17 已签到连续签到19天,获得了20个金钱
/** * @return \yii\db\ActiveQuery */ public function getUser() { return $this->hasOne(UserProfile::className(), ['user_id' => 'user_id']); }
class InquiryRecordSearch extends InquiryRecord
{public $mobile; public $nickname; /** * @inheritdoc */ public function rules() { return [ [['id', 'status', 'create_time', 'car_models_id', 'user_id'], 'integer'], [['order_id'], 'string'], [['mobile','nickname'],'safe'], ]; } /** * @inheritdoc */ public function scenarios() { // bypass scenarios() implementation in the parent class return Model::scenarios(); } /** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = InquiryRecord::find(); // add conditions that should always apply here $query->joinWith(['user']); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'pagination' => [ 'defaultPageSize'=>Yii::$app->params['defaultPageSize'] ], 'sort'=>[ 'defaultOrder' => [ 'id' => SORT_DESC ] ], ]);
$dataProvider->setSort([ 'attributes' => [ /* 其它字段不要动 */ /* 下面这段是加入的 */ /*=============*/ 'mobile' => [ 'asc' => ['mobile' => SORT_ASC], 'desc' => ['mobile' => SORT_DESC], 'label' => 'Mobile' ], 'nickname' => [ 'asc' => ['nickname' => SORT_ASC], 'desc' => ['nickname' => SORT_DESC], 'label' => 'Nickname' ], /*=============*/ ] ]); $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; } // grid filtering conditions $query->andFilterWhere([ 'id' => $this->id, 'order_id' => $this->order_id, 'status' => $this->status, 'create_time' => $this->create_time, 'car_models_id' => $this->car_models_id, 'user_id' => $this->user_id, ]); $query->andFilterWhere(['like', 'mobile', $this->mobile]); $query->andFilterWhere(['like', 'nickname', $this->nickname]); return $dataProvider; }
}
GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ //['class' => 'yii\grid\SerialColumn'], //'id', 'order_id', [ 'attribute' => 'nickanme', 'label' => '申请人', 'value' => 'user.nickname', 'filter' => Html::activeTextInput($searchModel, 'nickname', [ 'class' => 'form-control' ]), ], [ 'attribute' => 'mobile', 'label' => '联系电话', 'value' => 'user.mobile', 'filter' => Html::activeTextInput($searchModel, 'mobile', [ 'class' => 'form-control' ]), ],
- 嗯嗯 2017-03-16 已签到连续签到18天,获得了20个金钱
- 嗯嗯 发表了说说下班,发工资啦!!!!
- 嗯嗯 发表了说说靠谱,别放弃
- 嗯嗯 2017-03-15 已签到连续签到17天,获得了20个金钱
- 嗯嗯 发表了说说美女卡
- 嗯嗯 2017-03-14 已签到连续签到16天,获得了20个金钱