Unable to add Actions Inside Placeholder content of edit modal form.
How can I add an action inside Placehoder inside form widget.
Here is how I have used Placeholder:
Placeholder::make('notes')
->label('')
->content(
function ($record) {
if ($record?->notes) {
foreach ($record?->notes as $note) {
echo "<div class='bg-gray-100 p-2 mb-2 rounded-lg'>";
// echo "<div class='text-sm text-gray-500'>{$note->user->name} - {$note->created_at->diffForHumans()}</div>";
echo "<div class='text-sm'>{$note->content}</div>";
echo "</div>";
}
}
}
),
I am displaying the notes of a user and I want to add a delete/remove action next to each note
Solution:Jump to solution
Why don't you use a Repeater instead?
If you really want custom formatting, you are better off with a custom view file or view field...
5 Replies
Solution
Why don't you use a Repeater instead?
If you really want custom formatting, you are better off with a custom view file or view field
@Dennis Koch I don't really like the UI of Repeater. Here is my current UI and here adding a delete button would look more clean then Repeater. By using repeater It makes my edit modal scrollable and UI starts getting annoying.
Since it’s only one field the simple repeater might work. But there’s also #awcodes-table-repeater maybe that will work.
If you don't like the repeater you should create a custom field or use a view field. But putting this all inside Placeholder is hacky as hell
@Dennis Koch Thanks Repeater works for me for now so I will go with it