<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
interaction-design-foundation / nova-unlayer-field example snippets
use InteractionDesignFoundation\NovaUnlayerField\Unlayer;
public function fields()
{
return [
Unlayer::make('Content', 'design')->config([
'projectId' => config('unlayer.project_id'),
// optional
'templateId' => config('unlayer.default_template_id'), // Used only if bound attribute ('design' in this case) is empty.
'displayMode' => 'web', // "email" or "web". Default value: "email"
'locale' => 'es', // Locale for Unlayer UI. Default value: application’s locale.
]),
];
}
Unlayer::make('Design')->config([
'projectId' => config('unlayer.project_id'),
])
->savingCallback(function (NovaRequest $request, $attribute, Newsletter $newsletterModel, $outputHtmlFieldName) {
// set output HTML to your model (Newsletter in this case)
// No need to call $model->save() — Nova will do it down the road.
$newsletterModel->html = $request->input($outputHtmlFieldName);
}),
sh
php artisan vendor:publish --provider="InteractionDesignFoundation\NovaUnlayerField\ServiceProvider" --tag=config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.