Blade Components - set values with setters rather than __construct #42881
Unanswered
kieranmetcalfe
asked this question in
Ideas
Replies: 0 comments
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.
-
Hi,
Just wanted to check if I'm missing something.
I have a suite of form components which I've made using Blade Components. I've realised that there's a good number of attributes which I'd like to globalise as they occur in a number of components (but not always all of them).
I'd love to make Traits which encapsulate these values and how they are set, and be able to use:
function setFoo($value) {
// setter code
}
to do this, rather than having a huge __construct signature (with setter logic duplicated between component classes).
Is this possible? There's nothing in the documentation to suggest it's possible, but feels like a nice way to handle it.
Thanks,
Kieran
Beta Was this translation helpful? Give feedback.
All reactions