Updating Pages in Notion with properties is exactly the same as the Page Creation:
Just create a Page object and set specific properties. First parameter is always your
$property_key is your given title of the property within your table in Notion.
Always make sure the title of the properties match exactly with your database.
In addition to that you need to set the
$pageId of the page you want to update.
All properties you don't set for the update will not be touched/changed
✨ Below a summary of how to set all properties within a page.
$page = new Page(); # !Important for updating the page $page->setId($pageId); # property: title $page->setTitle("Name", "I was created by you"); # property: multi_select $page->setMultiSelect("Tags", ["awesome"]); # property: select $page->setSelect("Created from", "Laravel"); # property: text $page->setText("Comment", "Isn't this awesome?"); # property: checkbox $page->setCheckbox("Is this great?", true); # property: relation $page->setRelation("Connected Pages of other Notion-DB", [$id_of_other_notion_database_page, $id_of_other_notion_database_page2]); # property: people $page->setPeople("Responsible People", [$user_id_of_connected_user, $user_id_of_connected_user2]); # property: url $page->setUrl("Website", "https://5amco.de"); # property: email $page->setEmail("Contact E-Mail", "firstname.lastname@example.org"); # property: number $page->setNumber("Invoice Sum", 500); # property: phone_number $page->setPhoneNumber("Contact Number", "+49 123456789"); \Notion::update($page);
If you don't like to set the properties with a specific method in page, you can always use a generic method and instantiate the properties with a static method.
Just make sure you add the property-class to your imports.
use FiveamCode\LaravelNotionApi\Entities\Properties\Title; $page = new Page(); # !Important for updating the page $page->setId($pageId); # property: title $page->set("Name", Title::value("I was created by you")); // [...] Basically the same as in the above example. \Notion::update($page);