'int', 'brokerid' => 'int', 'workerid' => 'int', 'agentid' => 'int', 'title' => 'string', 'origin_value' => 'decimal', 'value' => 'decimal', 'remark' => 'string', 'status' => 'int', 'type' => 'int', 'createtime' => 'int', 'yeartime' => 'int', 'monthtime' => 'int', ]; // 设置字段自动转换类型 protected $type = [ 'createtime' => 'timestamp:Y-m-d H:i:s', ]; // 关联User public function broker() { return $this->hasOne(Broker::class, "id", "brokerid"); } public function getTypeTextAttr($value, $data) { $type = [1 => '普通', 2 => '提现']; return $type[$data['type']]; } public function getStatusTextAttr($value, $data) { $type = [1 => '待处理', 2 => '已成功', 3 => '已拒绝']; return $type[$data['status']]; } }