Upgrading to Livewire 4
Important
There are no changes in maryUI components.
This is about Livewire/Volt and has nothing to do with maryUI.
Do I need this?
If you use class-based components with Volt, yes.
# views/pages/users/show.blade.php use Livewire\Volt\Component; // It extends from Volt... new class extends Component { //...}
# routes/web.php Volt::route('/users/show', 'users.show');
What happened?
Now Livewire offers native support for class-based components. So, you need to remove Volt to avoid conflicts.
Upgrade
Install Livewire 4 Beta.
composer require livewire/livewire:^4.0@beta
Make all components to extend from Livewire\Component.
# views/pages/users/show.blade.php -use Livewire\Volt\Component; +use Livewire\Component; ... new class extends Component { // ... }
Change the routes at routes/web.php
// Imports-use Livewire\Volt\Volt; ... // Routes-Volt::route('/users/show', 'users.show'); +Route::livewire('/users/show', 'pages::users.show'); ...
Move all the layout files.
`resources/views/components/layouts/*.blade.php` ➡️ `resources/views/layouts/*.blade.php
Change the path of the custom layouts, if you have it.
new-#[Layout('components.layouts.custom')] +#[Layout('layouts.custom')] class extends Component { // ... };
Remove this entry at bootstrap/providers.php.
return [ App\Providers\AppServiceProvider::class,- App\Providers\VoltServiceProvider::class, ... ];
Remove Volt.
rm app/providers/VoltServiceProvider.phpcomposer remove livewire/volt
Clear the cache.
php artisan config:clearphp artisan view:clear
Made with
by
Robson Tenório and contributors.