| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Model;
- use Illuminate\Database\Eloquent\Model;
- // 自定义项存储表
- class CustomFieldValue extends DataScopeBaseModel
- {
- protected $guarded = [];
- protected $table = "custom_field_values"; //指定表
- const CREATED_AT = 'crt_time';
- const UPDATED_AT = 'upd_time';
- protected $dateFormat = 'U';
- const type_one = 1;
- const type_two = 2;
- const type = [
- self::type_one => '文本',
- self::type_two => '附件',
- ];
- const delivery_zero = 0;
- const delivery_one = 1;
- const delivery = [
- self::delivery_zero => '否',
- self::delivery_one => '是',
- ];
- public function definition()
- {
- // 即使你不需要它的数据,whereHas 也要靠这个方法生成 SQL 的 JOIN 或 EXISTS
- return $this->belongsTo(CustomFieldDefinitions::class, 'definition_id');
- }
- }
|