Skip to content

Commit 372c924

Browse files
committed
Fix demo
1 parent d3ba2e4 commit 372c924

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

demo/app/Sharp/Posts/PostForm.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use Code16\Sharp\Form\Layout\FormLayoutTab;
3131
use Code16\Sharp\Form\SharpForm;
3232
use Code16\Sharp\Utils\Fields\FieldsContainer;
33+
use Illuminate\Support\Carbon;
3334
use Illuminate\Support\Facades\Blade;
3435

3536
class PostForm extends SharpForm
@@ -130,8 +131,8 @@ public function buildFormFields(FieldsContainer $formFields): void
130131
Including {{ count($attachments) }} attachments
131132
({{ count($fileAttachments) }} files, {{ count($linkAttachments) }} links).
132133
blade, [
133-
'published_at' => \Carbon\Carbon::parse($data['published_at'])->isoFormat('LLLL'),
134-
'author' => \App\Models\User::find($data['author_id']),
134+
'published_at' => isset($data['published_at']) ? Carbon::parse($data['published_at'])->isoFormat('LLLL') : null,
135+
'author' => isset($data['author_id']) ? User::find($data['author_id']) : null,
135136
'attachments' => $data['attachments'] ?? [],
136137
'linkAttachments' => collect($data['attachments'] ?? [])->where('is_link', true),
137138
'fileAttachments' => collect($data['attachments'] ?? [])->where('is_link', false),

0 commit comments

Comments
 (0)