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
{
public $skill_name;
public $skills;
/**
* {@inheritdoc}
*/
@ -22,7 +22,7 @@ class UserCardSearch extends UserCard
return [
[['id', 'gender', 'status'], 'integer'],
[['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)
{
$query = UserCard::find();
// add conditions that should always apply here
//try join 3 tables
@ -80,8 +79,8 @@ class UserCardSearch extends UserCard
->andFilterWhere(['like', 'passport', $this->passport])
->andFilterWhere(['like', 'photo', $this->photo])
->andFilterWhere(['like', 'email', $this->email]);
$query->andFilterWhere(['skill.id' => $this->skill_name]);
$query->andFilterWhere(['skill.id' => $this->skills]);
return $dataProvider;
}

View File

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