What's the reason for splitting views into Components and Pages in the admin hub? #172
-
For example:
Is this considered best practice? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @pixelpeter Livewire auto-loads components based on the config setting in the main Laravel app. Being inside a package, we didn't want to try and mess around with it as it likely would have an impact on how Livewire works at the app level. The issue was we can reference the component fine for the route, but as soon as you try and do any Livewire requests, it would throw a 404 as it can't auto-load the component since it doesn't live in the namespace. The workaround was as you outlined above, we register the components manually (although we've discussed making our own auto-loader) and then in the page component we call the registered one. You're right in the fact that some components do look the same, but in the name of keeping things consistent, we opted to do all components like this. |
Beta Was this translation helpful? Give feedback.
Hi @pixelpeter
Livewire auto-loads components based on the config setting in the main Laravel app. Being inside a package, we didn't want to try and mess around with it as it likely would have an impact on how Livewire works at the app level.
The issue was we can reference the component fine for the route, but as soon as you try and do any Livewire requests, it would throw a 404 as it can't auto-load the component since it doesn't live in the namespace.
The workaround was as you outlined above, we register the components manually (although we've discussed making our own auto-loader) and then in the page component we call the registered one. You're right in the fact that some components do…