Introduce $slotVariables to class-based components #52955
Unanswered
Pennywise96
asked this question in
Ideas
Replies: 1 comment 2 replies
-
I would love to review the changes you made. Unfortunately you didn't start by creating a baseline in Github (or by forking Laravel) and then adding your changes as a separate commit where I can see the diff. And I don't have time to work out what changes were made in the files your refer to. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I’ve been experimenting with Blade’s class-based components and made some enhancements.
In this repository, I introduced
$slotVariables
to a class-based component. This allows developers to specify which public properties or methods should be passed to the slot.You can explore the changes in the repo: https://github.com/Pennywise96/slotVariables.
I’ve already created a route and view,
/test
, with a<x-posts>
component for testing.How it looks in the view:
Changes made:
Component.php
$slotVariables
slotData()
CompilesComponents.php
public static function compileClassComponentOpening()
to inject and extractslotData()
public function compileEndComponentClass(
) to unset the injected dataI believe the code can be further improved, and I’d appreciate your feedback on how to make it more elegant.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions