> */ public function rules(): array { $isStudio = $this->route('studio') !== null; return [ 'word' => ['required', 'string', 'max:1024'], 'tag' => ['sometimes', 'nullable', 'string', 'max:1024', 'not_regex:/@/'], 'meaning' => ['required', 'string', 'max:1024'], 'other_meaning' => ['sometimes', 'nullable', 'string', 'max:1024'], 'note' => ['sometimes', 'nullable', 'string'], 'summary' => ['sometimes', 'nullable', 'string'], 'quality' => ['sometimes', 'nullable', 'string', Rule::in(DhammaTerm::QUALITIES)], 'content_type' => ['sometimes', 'string', Rule::in(DhammaTerm::CONTENT_TYPES)], 'redirect' => ['sometimes', 'nullable', 'string', 'max:1024'], 'language' => [$isStudio ? 'required' : 'prohibited', 'string', 'max:16'], ]; } }