getPk(); $model->$pk = \app\common\library\SnowFlake::generateParticle(); } public function getIdAttr($value): string { return (string)$value; } public function getPayAmountAttr($value): float { return (float)$value; } public function getImagesAttr($value): array { if ($value === '' || $value === null) return []; if (!is_array($value)) { return explode(',', $value); } return $value; } public function setImagesAttr($value): string { return is_array($value) ? implode(',', $value) : $value; } public function reqOrder() { return $this->belongsTo(\app\admin\model\ReqOrder::class, 'req_id', 'id'); } }