Replies: 1 comment 2 replies
-
Nope, you could manually create a new state object and pass it a new model instance if you really want to. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
first of all thanks for the nice package!
Am using multiple states for some models and everything works as expected. Now am in a situation where I need the color and other values of the state outside of the model itself. The purpose is, that I will group models in a visual way by state.
Each visual group will have the state title, a status color and a description. All the data is available IN the model of course. But not outside of the foreach.
I've just created a plain PHP example of what I would like to achieve. Please note the comments.
After spending endless time to figuring out whether there is a way to achieve this, I assume it's not or I am just not getting it right.
What I would need is something like
AuditFindingItem::getStates()
but with an parameter likeAuditFindingItem::getStates('withData')
which returns not onlybut more like
I understand, that to create a class to get the data requires the specific model.
But is there really no other way to access the data without being in the model context? Can anyone please point me in the right direction how I can achieve this, without moving most of the data out of the state class or maintaining twice?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions