diff --git a/src/Notion/Properties/MultiSelect.php b/src/Notion/Properties/MultiSelect.php index a062876..11922dd 100644 --- a/src/Notion/Properties/MultiSelect.php +++ b/src/Notion/Properties/MultiSelect.php @@ -1,7 +1,24 @@ config->multi_select)) { + $this->config->multi_select = (object)[]; + } + + if (!is_array($value)) $value = [$value]; + $this->config->multi_select = array_map(fn($el) => (object)['name' => (string)$el], $value); + } + + public function getValue() + { + $withoutOptions = Arr::except((array)$this->config->multi_select, 'options'); + return count($withoutOptions) ? (object)$withoutOptions : null; + } } diff --git a/src/Notion/Properties/Number.php b/src/Notion/Properties/Number.php index 6f0a1d9..b250d4f 100644 --- a/src/Notion/Properties/Number.php +++ b/src/Notion/Properties/Number.php @@ -4,4 +4,19 @@ class Number extends PropertyBase { + public function value() + { + return $this->config->number; + } + + public function set($value): void + { + + $this->config->number = ($value === (int)$value) ? (int)$value : (float)$value; + } + + public function getValue() + { + return $this->config->number; + } }