// Access properties from a specific page
$page = \Notion::pages()
->find($pageId);
// Returns all properties as collection
$page->getProperties();
// Returns specific property by propertyKey
$page->getProperty($propertyKey);
// Returns specific property content by propertyKey (returned type depends on the property-type)
$page->getProperty($propertyKey)->getContent();
// Returns specific property content by propertyKey (array of exact Notion API structure is returned)
$page->getProperty($propertyKey)->getRawContent();
// Returns array of propertyKeys (names/titles of properties)
$page->getPropertyKeys();
// Return json-array of all properties
$page->getRawProperties();
There are several property classes available; see src/Entities/Properties
.
$page = \Notion::pages()->find($pageId);
// Property MultiSelect
$multiSelectProperty = $page->getProperty($propertyKeyOfMultiSelect); // returns MultiSelect::class
$mutliSelectProperty->getNames(); // returns array of names. For example: ['vegan recipe', 'sweet', 'healthy']
$mutliSelectProperty->getColors(); // returns array of colors. For example: ['blue', 'yellow', 'green']
$multiSelectProperty->getItems(); // returns Collection of SelectItem::class
$multiSelectProperty->getItems()->first()->getName(); // returns name of specific SelectItem
$multiSelectProperty->getItems()->first()->getColor(); // returns color of specific SelectItem