Upgrading to Livewire 4
Important
There are no changes in maryUI components.
This is about Livewire/Volt and has nothing to do with maryUI.
This site is running with Livewire 4. If you find some bug, please report it.
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.
Brand new projects
Just install maryUI from dev-livewire-4 branch and you are done!
composer require robsontenorio/mary:dev-livewire-4
php artisan mary:install
Existing projects
Install Livewire 4.
# TODO: update this when Livewire 4 is released
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.php
composer remove livewire/volt
Clear the cache.
php artisan config:clear
php artisan view:clear