Skip to content

Commit e01298a

Browse files
committed
cleanup
1 parent 3ff530f commit e01298a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

demo/app/Sharp/Posts/PostForm.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ public function buildFormFields(FieldsContainer $formFields): void
120120
by {{ $author->name }}.
121121
@endif
122122
<br>
123-
{{ count($linkAttachments) }} link attachments, {{ count($fileAttachments) }} file attachments.
123+
Including {{ count($attachments) }} attachments
124+
({{ count($fileAttachments) }} files, {{ count($linkAttachments) }} links).
124125
blade, [
125126
'published_at' => \Carbon\Carbon::parse($data['published_at'])->isoFormat('LLLL'),
126127
'author' => \App\Models\User::find($data['author_id']),
127-
'linkAttachments' => collect($data['attachments'])->where('is_link', true)->values(),
128-
'fileAttachments' => collect($data['attachments'])->where('is_link', false)->values(),
128+
'attachments' => $data['attachments'] ?? [],
129+
'linkAttachments' => collect($data['attachments'] ?? [])->where('is_link', true),
130+
'fileAttachments' => collect($data['attachments'] ?? [])->where('is_link', false),
129131
]);
130132
})
131133
)

0 commit comments

Comments
 (0)