Skip to content
Discussion options

You must be logged in to vote

if anyone ended up here, this works:

Field::macro('showWhen', function ($condition) {
    if ($condition === true) {
        $this->show();
    } else {
        $this->hide();
    }
    return $this;
});

Field::macro('showUnless', function ($condition) {
    if ($condition === true) {
        $this->hide();
    } else {
        $this->show();
    }
    return $this;
});

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@crynobone
Comment options

@magdicom
Comment options

@crynobone
Comment options

@crynobone
Comment options

@magdicom
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by magdicom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants