Skip to content

Using Icons in Content blade #59

Answered by lukas-frey
realknotworking asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah you cannot do that this way.

Blade is rendered on the server, whereas the data from the calendar is client side, thus is processed AFTER blade was already compiled.

What you can do though is render the icon directly on the server in your toEvent method of your model and store the complete SVG in an extendedProp instead.

This will increase the payload of each event though, so keep that in mind so it doesn't slow your app too much.

I'm on the phone now, I can send an example later

EDIT:

In your model's toEvent method you could do something like this:

public function toEvent(): Event|array {
    return Event::make($this)
        // All your other settings
        ->extendedProp('icon', svg

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by realknotworking
Comment options

You must be logged in to vote
1 reply
@lukas-frey
Comment options

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