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
I don't quite follow, can you explain a bit more please?
Could it be an accessor?
https://laravel.com/docs/10.x/eloquent-mutators#defining-an-accessor
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.
This is the code I am referring to.
instead of copying the value it gets the ID that is saved in the database
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.
->copyable()
doesn't have options to modify the content. Maybe try getStateUsing()
instead of formatStateUsing()
to set the state and not only the formattingthanks, that worked!