|string> */ public function rules(): array { $rules = [ 'project_id' => [ 'required', Rule::exists('projects', 'id')->where($this->userCompanyWhere()), ], 'requirement_id' => [ Rule::exists('requirements', 'id')->where($this->userCompanyWhere()), ], 'naming_rule_id' => [ Rule::when($this->get('naming_rule_id') > 0, [ Rule::exists('naming_rules', 'id')->whereIn('company_id', [ 0, Auth::user()->company_id, ]), ]) ], 'assign' => [ Rule::exists('users', 'id')->where($this->userCompanyWhere()), ], 'name' => 'required|max:255', 'parent_id' => [ Rule::when($this->get('parent_id') > 0, [ Rule::exists('tasks', 'id')->where($this->userCompanyWhere())->where("parent_id", 0), ]) ], 'begin' => 'date', 'end' => 'date', 'acl' => [ new Enum(TaskACL::class), ], 'whitelist' => $this->usersCompanyRules(), 'mailto' => $this->usersCompanyRules(), ]; $taskRules = $this->customFieldRuleByGroup("task", ['doc_type', 'task_type', 'doc_stage', "state", "suitability"]); if ($this->has("naming_rule_id") && $this->get("naming_rule_id") > 0) { $this->namingRuleCheck($this->get("naming_rule_id")); $namingRules = $this->customFieldRuleByGroup($this->get("naming_rule_id")); $rules = [...$rules, ... $namingRules]; } return [...$rules, ...$taskRules]; } }