12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare (strict_types = 1);
- namespace app\model;
- use think\Model;
- /**
- * 医学计算器选项模型
- * Class MedicalOption
- * @package app\model
- */
- class MedicalOption extends Model
- {
- /**
- * 数据表名称
- * @var string
- */
- protected $name = 'medical_options';
- /**
- * 自动写入时间戳
- * @var bool
- */
- protected $autoWriteTimestamp = false;
- /**
- * 设置字段信息
- * @var array
- */
- protected $schema = [
- 'id' => 'int',
- 'medical_question_id'=> 'int',
- 'content' => 'string',
- 'score' => 'float'
- ];
- /**
- * 允许批量赋值的字段
- * @var array
- */
- protected $allowField = [
- 'medical_question_id',
- 'content',
- 'score'
- ];
- /**
- * 获取所属问题
- */
- public function question()
- {
- return $this->belongsTo(MedicalQuestion::class, 'medical_question_id', 'id');
- }
- }
|