laravel-mjml icon indicating copy to clipboard operation
laravel-mjml copied to clipboard

Undefined variable $abc

Open eaponiente opened this issue 2 years ago • 2 comments

When I pass a variable to the view content I get this issue

public function content()
    {
        return new Content(
            view: $this->mjml('test')->buildMjmlView()['html'],
            with: [
                'abc' => 'Dummy Sentence'
            ]
        );
    }

eaponiente avatar Feb 10 '23 01:02 eaponiente

I have the same problem, any ideas?

olivermbs avatar Jun 06 '23 12:06 olivermbs

Maybe it's been solved but for future notice I use it like this

    public function content()
    {
        return new Content(
            view: $this->mjml('emails.reservation',
                [
                    'name' => 'John Doe',
                    'price' => '1000'
                ])
                ->buildMjmlView()['html'],
        );

    }

and the view

<mjml>
    <mj-body >
        <mj-column>
            <mj-text>{{$name}}</mj-text>
            <mj-text>{{$price}}</mj-text>
        </mj-column>
    </mj-body>
</mjml>

marin-yxz avatar Jun 19 '23 15:06 marin-yxz