EavAttributeModel.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. namespace SixShop\Eav\Model;
  4. use think\Model;
  5. use think\model\concern\SoftDelete;
  6. use think\model\relation\HasMany;
  7. /**
  8. * Class SixShop\Eav\Model\EavAttributeModel
  9. *
  10. * @property bool $is_required 是否必填
  11. * @property int $entity_type_id 关联实体类型
  12. * @property int $id
  13. * @property string $attribute_code 属性编码
  14. * @property string $backend_type 存储类型(int/varchar/decimal/text), 需与frontend_input匹配
  15. * @property string $create_time
  16. * @property string $delete_time
  17. * @property string $frontend_input 表单控件类型
  18. * @property string $frontend_label 显示标签
  19. * @property string $update_time
  20. * @method static \think\db\Query onlyTrashed()
  21. * @method static \think\db\Query withTrashed()
  22. */
  23. class EavAttributeModel extends Model
  24. {
  25. use SoftDelete;
  26. protected function getOptions(): array
  27. {
  28. return [
  29. 'name' => 'extension_eav_attribute'
  30. ];
  31. }
  32. public function optionList(): HasMany
  33. {
  34. return $this->hasMany(EavAttributeOptionModel::class, 'attribute_id', 'id');
  35. }
  36. }