PositionCheck.php 870 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2021 勾股工作室
  4. * @license https://opensource.org/licenses/GPL-2.0
  5. * @link https://www.gougucms.com
  6. */
  7. namespace app\admin\validate;
  8. use think\Validate;
  9. class PositionCheck extends Validate
  10. {
  11. protected $rule = [
  12. 'title' => 'require|unique:position',
  13. 'work_price' => 'require|number',
  14. 'id' => 'require'
  15. ];
  16. protected $message = [
  17. 'title.require' => '岗位名称不能为空',
  18. 'title.unique' => '同样的岗位名称已经存在',
  19. 'work_price.require' => '岗位工时单价不能为空',
  20. 'work_price.number' => '岗位工时单价只能是整数',
  21. 'id.require' => '缺少更新条件',
  22. ];
  23. protected $scene = [
  24. 'add' => ['title', 'work_price', 'group_id'],
  25. 'edit' => ['title', 'work_price', 'group_id', 'id'],
  26. ];
  27. }