步骤模型示例
<?php
namespace app\model;
use app\steps\Check;
use app\steps\Input;
use app\steps\Withdrawal;
use tpScriptVueCurd\FieldCollection;
use tpScriptVueCurd\option\generate_table\GenerateTableOption;
/**
* 需要继承 \tpScriptVueCurd\base\model\BaseModel 模型类
* Class Project
* @package app\model
*/
class Project extends \tpScriptVueCurd\base\model\BaseModel
{
/**
* 表字段配置
* @return FieldCollection
* @throws \think\Exception
*/
public function fields(): FieldCollection
{
return FieldCollection::make([
...Input::make()->getFields()->all(),
...Check::make()->getFields()->all(),
...Withdrawal::make()->getFields()->all(),
])->step(true);
}
public function generateTable(GenerateTableOption $table): bool
{
$table->setModifyColumn(true);
return true;
}
}