Support the ongoing development of Laravel.io →
posted 1 year ago
Laravel

I have upgraded to livewire 3 from livewire 2. having a lot of livewire component

Want to use Volt.

But getting error in regular page/livewire page while adding App\Providers\VoltServiceProvider::class in config/app.php providers array.

Normal error like Undefined variable. Despite being variable defined.

for Example:

In a blade file I assigned a variable $hello = 'world'.

In very next line I am printing echo $hello.

Output undefined variable $hello.

just after adding App\Providers\VoltServiceProvider::class class.

If I comment/delete this provider from provider array everything working as expected

Alt text

volt error

Last updated by @polodev 1 year ago.
0
moderator

The <?php tag doesn't work in your blade file, you need to use @php with @endphp

See: https://laravel.com/docs/10.x/blade#raw-php

0

Sign in to participate in this thread!

PHPverse

Your banner here too?

polodev polodev Joined 20 Apr 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.