-
Notifications
You must be signed in to change notification settings - Fork 902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Livewire widget #4971
Add Livewire widget #4971
Conversation
That sounds AWESOME. Well done @phpfour . I think there's only one thing missing from this: How can we make it easy for people to add a Livewire component... to an existing Backpack view? For example... what if you want to add charts inside the Show operation? Or a custom component, with a... livewire datatable, let's say 😀 That wouldn't work, because you don't have So then I'm wondering... is there a way to check if they have been loaded already? And if not, have the widget push those to |
[ci skip] [skip ci]
@tabacitu I just found the (btw not sure why StyleCI has pushed changes to 15 files) 😮 |
The inspection completed: No new issues |
Closing this in favor of Laravel-Backpack/theme-tabler#20. |
Since Livewire v3 launches 20 days after Backpack v6, I'm going to hold off on this PR and only merge it AFTER that. That way, we only have to support one version of Livewire. Which doesn't need workarounds because it brings its own Alpine and everything. |
Livewire v3 is out! So we need to take another look at this, polish it for v3, and decide if we can/should support both, or only Livewire v3. Wooohooo! |
WHY
BEFORE - What was wrong? What was happening before this PR?
There was no official widget to load a Livewire component.
AFTER - What is happening after this PR?
We're shipping an official Livewire widget.
HOW
How did you achieve that, in technical terms?
By including a widget file to load Livewire components.
Is it a breaking change?
No.
How can we test the before & after?
It can be tested with any Livewire component, here I am using https://github.com/asantibanez/livewire-charts as an example.
Install Livewire in a project where Backpack is already configured:
Install the Livewire Charts library:
Create
resources/views/vendor/backpack/base/dashboard.blade.php
file with below content:Visiting the dashboard will now show a chart loaded through a Livewire component:
DOCUMENTATION
The following section can be added to the documentation of Widgets:
Livewire Widget
You can easily load a Laravel Livewire component as a widget, all you have to specify is the component name and the parameters it expects. As an example, if a Livewire component is loaded regularly in this way:
...it can be loaded in a widget using this configuration:
Sometimes you may need to put additional HTML attributes in the container for the component – you can just pass them to the
attributes
key as an array: