步骤模型示例

    1. <?php
    2. namespace app\model;
    3. use app\steps\Check;
    4. use app\steps\Input;
    5. use app\steps\Withdrawal;
    6. use tpScriptVueCurd\FieldCollection;
    7. use tpScriptVueCurd\option\generate_table\GenerateTableOption;
    8. /**
    9. * 需要继承 \tpScriptVueCurd\base\model\BaseModel 模型类
    10. * Class Project
    11. * @package app\model
    12. */
    13. class Project extends \tpScriptVueCurd\base\model\BaseModel
    14. {
    15. /**
    16. * 表字段配置
    17. * @return FieldCollection
    18. * @throws \think\Exception
    19. */
    20. public function fields(): FieldCollection
    21. {
    22. return FieldCollection::make([
    23. ...Input::make()->getFields()->all(),
    24. ...Check::make()->getFields()->all(),
    25. ...Withdrawal::make()->getFields()->all(),
    26. ])->step(true);
    27. }
    28. public function generateTable(GenerateTableOption $table): bool
    29. {
    30. $table->setModifyColumn(true);
    31. return true;
    32. }
    33. }