'int', 'workerid' => 'int', 'title' => 'string', 'imageurl' => 'string', 'videourl' => 'string', 'status' => 'tinyint', 'createtime' => 'int' ]; // 设置字段自动转换类型 protected $type = [ 'createtime' => 'timestamp:Y-m-d H:i' ]; public function getStatusTextAttr($value,$data) { $status = [1=>'待审核',2=>'未通过',3=>'已通过']; return $status[$data['status']]; } // 关联Worker public function worker() { return $this->hasOne(Worker::class, "id", "workerid"); } }