How to set $elements values in Laravel Slack notification block classes #51908
Unanswered
sedwardsgt
asked this question in
Q&A
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.
-
I am converting a Laravel app from using Nathanhelfley/laravel-slack-blocks to using the built in Illuminate\Notifications\Slack\BlockKit\Blocks blocks, and I can't figure out how to pass in the
$elements
value. For instance, with aSlackBlock
class, I would do this for a context block;However, with the
ContextBlock
class, there is no interface to pass in the entire element (e.g.type => markdown
) because there is no setter for$elements
and it is protected. The same is true for the other block types. How do I pass in the other values for a block other than the text and the id?Per one suggestion, the correct implementation is something like this
But there are two problems
MarkdownText
class doesn't existTextObject
class does, and it has amarkdown()
setter. However, thetext()
method takes a string, not an object.Something like this doesn't work, for the same reason
But it's not just the
markdown
property. If you look at the doc block for the$elements
property in ActionsBlock, you seewhich indicates to me that there somewhere is a way to add to those elements (up to 25), since the Slack Blocks Reference indicates that there are many more things that can be added other than what these block kit classes allow.
Yes, I've seen the Laravel Notifications docs, but that doesn't really answer this question, either (unless I'm missing something).
So how do I build the blocks with all of the
$elements
values?Beta Was this translation helpful? Give feedback.
All reactions