<?php
namespace app\common\model;

use think\Model;

class FormLog extends Model
{
	// 设置字段信息
    protected $schema = [
        'id'			=> 'int',
		'userid'		=> 'int',
		'formid'		=> 'int',
		'remark'		=> 'string',
		'createtime'	=> 'int'
    ];
	
	// 设置字段自动转换类型
	protected $type = [
	    'createtime'	=> 'timestamp:Y-m-d H:i'
	];
	
	// 关联User
	public function user()
	{
	    return $this->hasOne(User::class, "id", "userid");
	}
	
	// 关联Form
	public function form()
	{
	    return $this->hasOne(Form::class, "id", "formid");
	}
	
	// 关联FormItem
	public function formItem()
	{
	    return $this->hasMany(FormItem::class, "itemid", "id");
	}

	// 关联FormLogval
	public function formLogval()
	{
	    return $this->hasMany(FormLogval::class, "logid", "id");
	}
	
	
}