add_skills

This commit is contained in:
SoHardKI 2019-07-03 16:06:11 +03:00
parent 6f7200ba7f
commit c7ea822e2d
2 changed files with 7 additions and 7 deletions

View File

@ -13,7 +13,7 @@ use backend\modules\card\models\UserCard;
*/ */
class UserCardSearch extends UserCard class UserCardSearch extends UserCard
{ {
public $skill_name; public $skills;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -22,7 +22,7 @@ class UserCardSearch extends UserCard
return [ return [
[['id', 'gender', 'status'], 'integer'], [['id', 'gender', 'status'], 'integer'],
[['fio', 'passport', 'photo', 'email', 'dob', 'created_at', 'updated_at'], 'safe'], [['fio', 'passport', 'photo', 'email', 'dob', 'created_at', 'updated_at'], 'safe'],
[['skill_name'],'string'], ['skills', 'each', 'rule' => ['integer']],
]; ];
} }
@ -45,7 +45,6 @@ class UserCardSearch extends UserCard
public function search($params) public function search($params)
{ {
$query = UserCard::find(); $query = UserCard::find();
// add conditions that should always apply here // add conditions that should always apply here
//try join 3 tables //try join 3 tables
@ -81,7 +80,7 @@ class UserCardSearch extends UserCard
->andFilterWhere(['like', 'photo', $this->photo]) ->andFilterWhere(['like', 'photo', $this->photo])
->andFilterWhere(['like', 'email', $this->email]); ->andFilterWhere(['like', 'email', $this->email]);
$query->andFilterWhere(['skill.id' => $this->skill_name]); $query->andFilterWhere(['skill.id' => $this->skills]);
return $dataProvider; return $dataProvider;
} }

View File

@ -71,10 +71,11 @@ $this->params['breadcrumbs'][] = $this->title;
]); ]);
}, },
'filter' => kartik\select2\Select2::widget([ 'filter' => kartik\select2\Select2::widget([
'attribute' => 'skill_name', 'attribute' => 'skills',
'model' => $searchModel, 'model' => $searchModel,
'data' => \common\models\UserCard::getNameSkills(), 'data' => \common\models\UserCard::getNameSkills(),
'options' => ['placeholder' => 'Выбрать параметр','class' => 'form-control'], // 'maintainOrder' => true,
'options' => ['multiple' => true,'placeholder' => 'Выбрать параметр','class' => 'form-control'],
'pluginOptions' => [ 'pluginOptions' => [
'allowClear' => true 'allowClear' => true
], ],