Skip to content

Commit d965fdf

Browse files
committed
Improve docs
1 parent 3202194 commit d965fdf

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@ composer require idf/nova-unlayer-field
1919

2020
## Usage
2121

22+
This package assumes that your Model has an attribute to store design config
23+
(it's better to use `json` or `longtext` SQL type to store it).
24+
25+
On submit, the package sends two fields:
26+
- design (stringified json object)
27+
- html code. If you want to store HTML to your model, please use `savingCallback()`
28+
2229
```php
2330
public function fields()
2431
{
2532
return [
26-
Unlayer::make('Payload Content')->config([
33+
Unlayer::make('Content', 'design')->config([
2734
'projectId' => config('unlayer.project_id'),
28-
'templateId' => config('unlayer.newsletter_template_id'),
29-
'displayMode' => 'email',
30-
'locale' => app()->getLocale(),
35+
'templateId' => config('unlayer.newsletter_template_id'), // Optional, used only if bound attribute is empty (e.g. $newsletter->design)
36+
'displayMode' => 'email', // Optional, "email" by default
37+
'locale' => app()->getLocale(), // Optional
3138
]),
3239
];
3340
}

0 commit comments

Comments
 (0)