CustomFieldValue.php 571 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Model;
  3. use Illuminate\Database\Eloquent\Model;
  4. // 自定义项存储表
  5. class CustomFieldValue extends DataScopeBaseModel
  6. {
  7. protected $guarded = [];
  8. protected $table = "custom_field_values"; //指定表
  9. const CREATED_AT = 'crt_time';
  10. const UPDATED_AT = 'upd_time';
  11. protected $dateFormat = 'U';
  12. public function definition()
  13. {
  14. // 即使你不需要它的数据,whereHas 也要靠这个方法生成 SQL 的 JOIN 或 EXISTS
  15. return $this->belongsTo(CustomFieldDefinitions::class, 'definition_id');
  16. }
  17. }