*/ public function rules(): array { $organisation = $this->route('organisation'); $orgId = $organisation instanceof Organisation ? $organisation->id : (string) $organisation; return [ 'library_field_id' => [ 'required', 'string', Rule::exists('form_field_library', 'id')->where('organisation_id', $orgId), ], 'overrides' => ['nullable', 'array'], 'overrides.label' => ['sometimes', 'string', 'max:255'], 'overrides.slug' => ['sometimes', 'string', 'max:100'], 'overrides.is_required' => ['sometimes', 'boolean'], 'overrides.sort_order' => ['sometimes', 'integer'], ]; } }