Skip to content
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

✨ Automatically expose public properties and methods on View Composers #320

Merged
merged 14 commits into from
Dec 11, 2023

Conversation

Log1x
Copy link
Member

@Log1x Log1x commented Dec 8, 2023

This gives Acorn's View Composers the same behavior as View Components exposing all public properties/methods automatically to the targeted view(s).

An added bonus to this is being able to easily invoke public methods using the variable inside a view such as $example($post->ID).

Most code is taken from Illuminate's Component.php and moved into a Trait.

This only takes effect when with() and override() are empty thus maintaining backwards compatibility.

Could use more testing.

Change log

  • ✨ Automatically expose public properties and methods on View Composers
  • 💥 Change the $ignore property to $except in the View Composer Arrayable trait

@Log1x Log1x requested a review from QWp6t December 8, 2023 21:41
@Log1x Log1x self-assigned this Dec 8, 2023
@QWp6t QWp6t merged commit 49fbe13 into main Dec 11, 2023
@QWp6t QWp6t deleted the feat/extract-public-composer-methods branch December 11, 2023 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants