© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
F
Filament
•
2y ago
•
5 replies
cenksen
Copy Action
Hello everyone
, I have the code below
. When copyFieldsToState is triggered
, I want to copy specific data
. How can I proceed this way
? Currently
, I can only print it with a notification
.
-
>hintAction
(
A
c
t
i
o
n
:
:make
(
'copyFieldsToState
'
)
-
>icon
(
'heroicon
-m
-clipboard
'
)
-
>action
(function
(array
&
$state
, Get
$get
)
{
if
(
!isset
(
$state
[
'copiedData
'
]
)
)
{
$state
[
'copiedData
'
]
=
'
'
;
}
$copiedData
= collect
(
$get
(
'ships
'
)
?
?
[
]
)
-
>map
(function
(
$ship
)
{
return
"Name
:
{
$ship
[
'name
'
]
}
,
IMO
:
{
$ship
[
'imo
'
]
}
,
Hull No
:
{
$ship
[
'hull
_no
'
]
}
,
Shipyard ID
:
{
$ship
[
'shipyard
_id
'
]
}
"
;
}
)
-
>implode
(
"
\n
-
-
-
\n
"
)
;
$state
[
'copiedData
'
]
=
$copiedData
;
N
o
t
i
f
i
c
a
t
i
o
n
:
:make
(
)
-
>title
(
'Fields copied to state
'
)
-
>body
(nl2br
(e
(
$copiedData
)
)
)
-
>success
(
)
-
>send
(
)
;
}
)
)
Solution
this may help
https://filamentglow.com/trick/copied-to-clipboard-on-suffix-action-2768391d
FilamentPHP Glow
Custom copy action
, click the icon to copy the content
Jump to solution
Filament
Join
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Was this page helpful?
Yes
No
Similar Threads
Recent Announcements
Similar Threads
Hint Action - Copy value
F
Filament / ❓┊help
2y ago
Button->Action to copy text?
F
Filament / ❓┊help
2y ago
Copy to clipboard action table
F
Filament / ❓┊help
3y ago
Action button - copy to clipboard
F
Filament / ❓┊help
3y ago