Mache Auswahl, Aufbau und Entwurf im Redaktionseditor bedienbar.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
6955830579
commit
053a361801
14 files changed
+1040
-155
No files matched your search
@@ -19,6 +19,7 @@ class Composition extends Model
|
||||
'kind',
|
||||
'editorial_content_kind_id',
|
||||
'archived_at',
|
||||
'working_draft',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
@@ -26,6 +27,7 @@ protected function casts(): array
|
||||
return [
|
||||
'kind' => CompositionKind::class,
|
||||
'archived_at' => 'datetime',
|
||||
'working_draft' => 'array',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Catalog;
|
||||
|
||||
class EditorialWorkingDraft
|
||||
{
|
||||
/**
|
||||
* @return array<string, mixed>|null
|
||||
*/
|
||||
public function read(Composition $composition): ?array
|
||||
{
|
||||
$draft = $composition->working_draft;
|
||||
|
||||
return is_array($draft) && $draft !== [] ? $draft : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
public function write(Composition $composition, array $payload): void
|
||||
{
|
||||
$composition->working_draft = $payload;
|
||||
$composition->save();
|
||||
}
|
||||
|
||||
public function clear(Composition $composition): void
|
||||
{
|
||||
if ($composition->working_draft === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$composition->working_draft = null;
|
||||
$composition->save();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user