add_skill_column_inuser_index

This commit is contained in:
SoHardKI
2019-07-03 13:55:32 +03:00
parent 9affc6b402
commit def33f55c2
6 changed files with 47 additions and 3 deletions

View File

@ -5,6 +5,7 @@ namespace common\models;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\Expression;
use yii\helpers\ArrayHelper;
/**
* This is the model class for table "user_card".
@ -140,4 +141,14 @@ class UserCard extends \yii\db\ActiveRecord
{
return $this->genders[$this->gender];
}
public function getSkillValues()
{
return $this->hasMany(CardSkill::class, ['card_id' => 'id'])->with('skill');
}
public static function getNameSkills()
{
return ArrayHelper::map(Skill::find()->all(),'id', 'name');
}
}