/**
  * 增加工作流步骤的时候的表单验证
  *
  * @access public
  */
 public function add(\App\Services\Admin\Workflow\Param\WorkflowStepSave $data)
 {
     // 创建验证规则
     $rules = array('name' => 'required', 'description' => 'required', 'step_level' => 'required', 'workflow_id' => 'required');
     // 自定义验证消息
     $messages = array('name.required' => Lang::get('workflow.workflow_name_empty'), 'description.required' => Lang::get('workflow.workflow_description_empty'), 'step_level.required' => Lang::get('workflow.workflow_step_level_empty'), 'workflow_id.required' => Lang::get('workflow.workflow_id_empty'));
     //开始验证
     $validator = Validator::make($data->toArray(), $rules, $messages);
     if ($validator->fails()) {
         $this->errorMsg = $validator->messages()->first();
         return false;
     }
     return true;
 }
Example #2
0
 /**
  * 编辑工作流步骤入库处理
  *
  * @access private
  */
 private function updateWorkflowStep()
 {
     $this->checkFormHash();
     $stepId = (int) Request::input('workflow_step_id');
     $workflowId = (int) Request::input('workflow_id');
     $data = (array) Request::input('data');
     $data['id'] = $stepId;
     $data['workflow_id'] = $workflowId;
     $params = new WorkflowStepSave();
     $manager = new Process();
     $params->setAttributes($data);
     if (!$manager->editWorkflowStep($params)) {
         return Js::error($manager->getErrorMessage());
     }
     $this->setActionLog();
     return Js::locate(route('workflow.step.index', ['id' => $workflowId]), 'parent');
 }