100], [['dt'], 'string', 'max' => 15], [['user_id', 'art'], 'unique', 'targetAttribute' => ['user_id', 'art'], 'message' => 'The combination of User ID and Art has already been taken.'] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => '№', 'art' => 'Нмер', 'dt' => 'Дата', 'name' => 'Клиент' ]; } public function getAccounts() { return $this->hasOne(Accounts::className(), ['id' => 'user_id']); } public function getName(){ if($this->accounts instanceof Accounts){ return "№{$this->user_id}, {$this->accounts->name}"; } else { return "№{$this->user_id}"; } } public function getDate(){ return date("Y-m-d H:i:s", $this->dt); } }