F
Filament3mo ago
Junaid

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:
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...
Jump to solution
5 Replies
Solution
Dennis Koch
Dennis Koch3mo ago
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
Junaid
Junaid3mo ago
@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.
No description
awcodes
awcodes3mo ago
Since it’s only one field the simple repeater might work. But there’s also #awcodes-table-repeater maybe that will work.
Dennis Koch
Dennis Koch3mo ago
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
Junaid
Junaid3mo ago
@Dennis Koch Thanks Repeater works for me for now so I will go with it
Want results from more Discord servers?
Add your server
More Posts
Correct way to apply a `withCount()` and `->having()` in a SelectFilter?I have a `Domain` that has many `Sites` and I want to filter by the total number of sites each domaiSend data from edit page to create page on a different resource.Im using Laravel v10 and Filament PHP v3 I have the following models: Client LegacyClient I want tWhere documentation From\Components\Group, and what different From\Components\Grid?I need to group fields without labels, and color the background. Should I use Group or Grid? Will thHow to change colors of action buttons/links?There is resource table I need to customize action buttons/links.How to prefix some routes or pages like ListRecords with '/admin' while others don't have the prefixI want a few routes in my app to have the 'admin' prefix while the others should remain intact. Is tIncluding a relationship form from a different Resource doesn't display repeater items in itI'm trying to cut down on my duplicated code, so inside a `OrderResource` I created this method ```pThe session is not shared across multiple domains with tenancyI have configured a tenant in the panel. It works fine, however, the sessions are not shared with otTo Change table column linkAs I know edit link is default to each table column when clicking. But I wanna change that into indeMulti TenancyGot all my edit functions running for a typically club situation (ie User / membership ) I have adConditional visibility of Repeater extraActions``` Repeater::make('records') ->extraItemActions([ Action::make('sendEmail')