/** * 编辑工作流入库处理 * * @access private */ private function updateWorkflow() { $params = new WorkflowSave(); $manager = new Process(); $params->setAttributes((array) Request::input('data')); if (!$manager->editWorkflow($params)) { return Js::error($manager->getErrorMessage()); } $this->setActionLog(); return Js::locate(route('workflow.index.index'), 'parent'); }
/** * 增加工作流的时候的表单验证 * * @access public */ public function add(\App\Services\Admin\Workflow\Param\WorkflowSave $data) { // 创建验证规则 $rules = array('name' => 'required', 'description' => 'required', 'code' => 'required'); // 自定义验证消息 $messages = array('name.required' => Lang::get('workflow.workflow_name_empty'), 'description.required' => Lang::get('workflow.workflow_description_empty'), 'code.required' => Lang::get('workflow.workflow_code_empty')); //开始验证 $validator = Validator::make($data->toArray(), $rules, $messages); if ($validator->fails()) { $this->errorMsg = $validator->messages()->first(); return false; } return true; }