<?php

use think\migration\Seeder;

class SysConfigTypeInit extends Seeder
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run(): void
    {
        $data = [
            ["name" => "图片", "value" => "image", "sort" => 1, "remark" => "图片上传"],
            ["name" => "文件", "value" => "file", "sort" => 2, "remark" => "文件上传"],
            ["name" => "文本", "value" => "text", "sort" => 3, "remark" => "文本输入框类型"],
            ["name" => "文本域", "value" => "textarea", "sort" => 4, "remark" => "文本域输入框类型"],
            ["name" => "下拉选项", "value" => "select", "sort" => 5, "remark" => "下拉选择框类型"],
            ["name" => "多选", "value" => "checkbox", "sort" => 6, "remark" => "多选框类型"],
            ["name" => "单选", "value" => "radio", "sort" => 7, "remark" => "单选框类型"]
        ];

        $table = $this->table('sys_config_type');
        
        // empty the table
        $table->truncate();

        // insert data
        $table->insert($data)->saveData();
    }
}