Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pages in table #386

Open
giulo opened this issue Aug 14, 2024 · 0 comments
Open

Add pages in table #386

giulo opened this issue Aug 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@giulo
Copy link

giulo commented Aug 14, 2024

Hi ,
i need to add pages under table named "DA CARICARE".
image
I 'm able to add pages ...
but these are always added to the last table named "Table" se image attached.
image
How can i add pages in the table named "DA CARICARE"
This is my code
$secret = $setting->api_key;
$notion = NotionHelper::client($secret);
$notion = Notion::create($secret);
$setting = Settings::find()->where(['type' => 'notion_database'])->one();
$databaseId = $setting->api_key;
$number = \Notion\Pages\Properties\RichTextProperty::fromString($numero);
$date = \Notion\Pages\Properties\Date::create(new \DateTimeImmutable(date('Y-m-d')));
$customer = \Notion\Pages\Properties\RichTextProperty::fromString($notdoc);
$link = \Notion\Pages\Properties\Url::create('https://www.notion.so/xxxxxxx/');
$referenza=\Notion\Pages\Properties\Title::fromString($sku);
$commento=\Notion\Pages\Properties\RichTextProperty::fromString("");
$state=\Notion\Pages\Properties\Select::fromName("New");
$createdby=\Notion\Pages\Properties\RichTextProperty::fromString("xxxxxx");
$linkasso=\Notion\Pages\Properties\Url::create("https://a**********/web/gb/orders/create?id=".$idtestata);
$arrivedfrom=\Notion\Pages\Properties\RichTextProperty::fromString("******");
$priority=\Notion\Pages\Properties\Select::fromName("Importato!");
$parent = \Notion\Pages\PageParent::database($databaseId);
$page = Page::create($parent)
->addProperty("Data inserimento", $date)
->addProperty("Nr. ordine", $number)
->addProperty("Cliente", $customer)
->addProperty("Link ordine", $link)
->addProperty("Referenza", $referenza)
->addProperty("Commento ordine", $commento)
->addProperty("Stato ordine", $state)
->addProperty("SCADENZA", $date)
->addProperty("Priorità", $priority)
->addProperty("Link Assostore", $linkasso)
->addProperty("Arrivato Da", $arrivedfrom);
$page = $notion->pages()->create($page);
Thanks .

@giulo giulo added the enhancement New feature or request label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant