Blade Component Registration #155
-
Thanks for this - it's really helpful, and I've purchased the accompanying video course. What I am trying to establish is the correct way to place blade components into the service provider as the video is out of sync with the skeleton class now. I have seen a discussion where there is some question raised about the correct path for the components files, in order to be able to use something like x-package::component - i simply can not get the classes to register. To avoid wasting precious code time - what is the correct path for component classes - and should they have the namespace of what is intended or what is correct at the time of creation? (Ie: if the directory is in the root of the package and not in src). |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hi, Thanks for have bought the course. The skeleton is indeed a bit out of sync, as the course is now 2 years old, but we still are improving the skeleton everyday. We'll record a new version of the course soon. Here's a good example of how we go about registering view component in a package How this helps! |
Beta Was this translation helpful? Give feedback.
-
Hi @freekmurze , thanks for the package. I also stumbled into this issue for like an hour. I think it's best to note in the readme about how to register the blade components as I think, everyone will use the hasViewComponents() |
Beta Was this translation helpful? Give feedback.
-
@freekmurze I'd submit a PR if I knew how to advise about this, the new video course is excellent, but I again fell over this issue having had some time away. The docs for the skeleton still advise using hasViewComponents() and the code suggests an array is fine for this - but I get a type error when using that. such as this:
|
Beta Was this translation helpful? Give feedback.
Hi,
Thanks for have bought the course. The skeleton is indeed a bit out of sync, as the course is now 2 years old, but we still are improving the skeleton everyday. We'll record a new version of the course soon.
Here's a good example of how we go about registering view component in a package
https://github.com/spatie/laravel-support-bubble/blob/2dc9d017baa973923b531e2083f91e727331aa1a/src/SupportBubbleServiceProvider.php#L30-L31
How this helps!