F
Filament14mo ago
ciorici

Copyable value with formatStateUsing function

I am trying to add a copyable option to a table column, but the value for it is changed using formatStateUsing function. Is there a way to change the value of that is being copied?
7 Replies
toeknee
toeknee14mo ago
I don't quite follow, can you explain a bit more please?
LeandroFerreira
LeandroFerreira14mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
ciorici
ciorici14mo ago
This is the code I am referring to.
ciorici
ciorici14mo ago
instead of copying the value it gets the ID that is saved in the database
Thijmen
Thijmen14mo ago
The find method searches on the primaryKey of the model. I don't think $state is the primaryKey. So better to replace it with a basic where statement.
Dennis Koch
Dennis Koch14mo ago
->copyable() doesn't have options to modify the content. Maybe try getStateUsing() instead of formatStateUsing() to set the state and not only the formatting
ciorici
ciorici14mo ago
thanks, that worked!