|
1 |
| -Please see [this repo](https://github.com/laravel-notification-channels/channels) for instructions on how to submit a channel proposal. |
2 |
| - |
3 |
| -# A Boilerplate repo for contributions |
4 |
| - |
5 |
| -[](https://packagist.org/packages/laravel-notification-channels/:package_name) |
6 |
| -[](LICENSE.md) |
7 |
| -[](https://travis-ci.org/laravel-notification-channels/:package_name) |
8 |
| -[](https://styleci.io/repos/:style_ci_id) |
9 |
| -[](https://insight.sensiolabs.com/projects/:sensio_labs_id) |
10 |
| -[](https://scrutinizer-ci.com/g/laravel-notification-channels/:package_name) |
11 |
| -[](https://scrutinizer-ci.com/g/laravel-notification-channels/:package_name/?branch=master) |
12 |
| -[](https://packagist.org/packages/laravel-notification-channels/:package_name) |
13 |
| - |
14 |
| -This package makes it easy to send notifications using [:service_name](link to service) with Laravel 5.5+, 6.x and 7.x |
15 |
| - |
16 |
| -**Note:** Replace ```Notion``` ```:service_name``` ```:author_name``` ```:author_username``` ```:author_website``` ```:author_email``` ```:package_name``` ```:package_description``` ```:style_ci_id``` ```:sensio_labs_id``` with their correct values in [README.md](README.md), [CHANGELOG.md](CHANGELOG.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE.md](LICENSE.md), [composer.json](composer.json) and other files, then delete this line. |
17 |
| -**Tip:** Use "Find in Path/Files" in your code editor to find these keywords within the package directory and replace all occurences with your specified term. |
18 |
| - |
19 |
| -This is where your description should go. Add a little code example so build can understand real quick how the package can be used. Try and limit it to a paragraph or two. |
20 |
| - |
21 |
| - |
22 |
| - |
23 |
| -## Contents |
24 |
| - |
25 |
| -- [Installation](#installation) |
26 |
| - - [Setting up the :service_name service](#setting-up-the-:service_name-service) |
27 |
| -- [Usage](#usage) |
28 |
| - - [Available Message methods](#available-message-methods) |
29 |
| -- [Changelog](#changelog) |
30 |
| -- [Testing](#testing) |
31 |
| -- [Security](#security) |
32 |
| -- [Contributing](#contributing) |
33 |
| -- [Credits](#credits) |
34 |
| -- [License](#license) |
35 |
| - |
36 |
| - |
37 | 1 | ## Installation
|
38 | 2 |
|
39 |
| -Please also include the steps for any third-party service setup that's required for this package. |
40 |
| - |
41 |
| -### Setting up the :service_name service |
42 |
| - |
43 |
| -Optionally include a few steps how users can set up the service. |
| 3 | +```shell |
| 4 | +composer require astroshippers/notion-notification-channel |
| 5 | +``` |
44 | 6 |
|
45 | 7 | ## Usage
|
46 | 8 |
|
47 |
| -Some code examples, make it clear how to use the package |
| 9 | +Inside eloquent model: |
48 | 10 |
|
49 |
| -### Available Message methods |
50 |
| - |
51 |
| -A list of all available options |
52 |
| - |
53 |
| -## Changelog |
54 |
| - |
55 |
| -Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. |
56 |
| - |
57 |
| -## Testing |
58 |
| - |
59 |
| -``` bash |
60 |
| -$ composer test |
| 11 | +```php |
| 12 | +public function routeNotificationForNotion(): array |
| 13 | +{ |
| 14 | + return [ |
| 15 | + 'token' => config('services.notion.token'), |
| 16 | + 'database' => '8e12b788392e4367b0532c9abb519133', |
| 17 | + ]; |
| 18 | +} |
61 | 19 | ```
|
62 | 20 |
|
63 |
| -## Security |
64 |
| - |
65 |
| -If you discover any security related issues, please email :author_email instead of using the issue tracker. |
66 |
| - |
67 |
| -## Contributing |
68 |
| - |
69 |
| -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. |
70 |
| - |
71 |
| -## Credits |
72 |
| - |
73 |
| -- [:author_name](https://github.com/:author_username) |
74 |
| -- [All Contributors](../../contributors) |
75 |
| - |
76 |
| -## License |
77 |
| - |
78 |
| -The MIT License (MIT). Please see [License File](LICENSE.md) for more information. |
| 21 | +Inside notification class: |
| 22 | + |
| 23 | +```php |
| 24 | +use NotificationChannels\Notion\{NotionChannel, NotionDatabaseItem}; |
| 25 | +use NotificationChannels\Notion\Properties\{Checkbox, Email, MultiSelect, Number, RichText, Status, Title, URL}; |
| 26 | + |
| 27 | +public function via($notifiable) |
| 28 | +{ |
| 29 | + return [NotionChannel::class]; |
| 30 | +} |
| 31 | + |
| 32 | +public function toNotion(User $notifiable): NotionDatabaseItem |
| 33 | +{ |
| 34 | + return NotionDatabaseItem::create() |
| 35 | + ->properties([ |
| 36 | + 'Name' => Title::make('John Doe'), |
| 37 | + 'Email' => Email::make(' [email protected]'), |
| 38 | + 'SomeNumber' => Number::make(12345), |
| 39 | + 'Tags' => MultiSelect::make(['blah', 'blah2', 'blah3']), |
| 40 | + 'True or False' => Checkbox::make(false), |
| 41 | + 'URL' => URL::make('https://developers.notion.com/reference/property-value-object'), |
| 42 | + 'Some Text' => RichText::make([ |
| 43 | + [ |
| 44 | + "type" => "text", |
| 45 | + "text" => [ |
| 46 | + "content" => "Some more text with ", |
| 47 | + ] |
| 48 | + ], |
| 49 | + ]), |
| 50 | + ]); |
| 51 | +} |
| 52 | +``` |
0 commit comments