'Новый', self::STATUS_PRINTED => 'Напечатан', self::STATUS_PAID => 'Оплачен', ]; } /** * @return string[] */ public static function getStatusColor(): array { return [ self::STATUS_NEW => '#FFA500', self::STATUS_PRINTED => '#008080', self::STATUS_PAID => '#32CD32', ]; } /** * {@inheritdoc} */ public static function tableName() { return 'check'; } /** * {@inheritdoc} */ public function rules() { return [ [['number', 'company_id', 'addresses_id'], 'required'], [['company_id', 'addresses_id', 'status'], 'integer'], [['number', 'title'], 'string', 'max' => 255], [['additional'], 'string'], [['addresses_id'], 'exist', 'skipOnError' => true, 'targetClass' => Addresses::class, 'targetAttribute' => ['addresses_id' => 'id']], [['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Company::class, 'targetAttribute' => ['company_id' => 'id']], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'number' => 'Номер', 'company_id' => 'Компания', 'additional' => 'Дополнительная информация', 'title' => 'Заголовок', 'addresses_id' => 'Отделение', 'status' => 'Статус', ]; } /** * Gets query for [[Addresses]]. * * @return \yii\db\ActiveQuery */ public function getAddresses(): \yii\db\ActiveQuery { return $this->hasOne(Addresses::class, ['id' => 'addresses_id']); } /** * Gets query for [[Company]]. * * @return \yii\db\ActiveQuery */ public function getCompany(): \yii\db\ActiveQuery { return $this->hasOne(Company::class, ['id' => 'company_id']); } }