asahasrabuddhe / laravel-mjml

Easily use MJML in your Laravel Blade templates!
MIT License
122 stars 51 forks source link

Undefined variable $abc #157

Open eaponiente opened 1 year ago

eaponiente commented 1 year ago

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'
            ]
        );
    }
olivermbs commented 1 year ago

I have the same problem, any ideas?

marin-yxz commented 1 year ago

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>