-
Notifications
You must be signed in to change notification settings - Fork 0
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
Version 4 #25
Conversation
Do any of the enhancement changes open the option to hook into the resource generation globally? As an example, I'd like to force every resource in a project to return an automatically generated |
I hadn't considered doing anything to support global, but I have been considering allowing for formats/enhancements for meta data. The with/additional data system provided by Laravel's resources is a little less straightforward, and the relationship between collections and meta data is something that would require some thought if we want to support enhancing it. Do you have an idea for how you'd want to apply these global enhancements? |
My initial thought was having it function like View composers, but the more I have thought about it the less sure I am about it being a useful feature. I have been trying to think of other data that makes sense to attach globally and have not though of anything else that wouldn’t require a big I will think about it some more to see if I can come up with anything else that could sanely make use of global hooks or a better approach to applying something like generic meta type data to each resource. |
README.md
Outdated
The easiest way to handle this is to set the `$collects` property on the enhanced collection or ensure that you're | ||
following the standard convention for resource and collection naming so that the `collects()` method can detect it. | ||
use Sourcetoad\EnhancedResources\Enhancements\Only; | ||
use Sourcetoad\EnhancedResources\Enhancements\Traits\HasExceptEnhancement; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be HasOnlyEnhancement
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Excited about all this new stuff! I like how the features are becoming more explicit and transparent
09db0e3
What is your opinion on resolving the In one of my projects, I previously created a custom collection resource handler to return the pagination meta information in a format I prefer. I decided to switch to the |
Resolving it makes a ton of sense. I'll look into adding that in a bit. |
…ow for easy overriding
Added Laravel 9 support, resolving AnonymousResourceCollection instead of direct instantiation, and tagged as v4.0.0-rc1. |
This might need to be pushed to v5 because of #26. Adding Laravel 9 support required me to drop PHP7.4 and Laravel 7 support. |
Version 4 seeks to make use of new functionality provided by PHP 8.0 and more strongly focus on formatting and a simpler, more extensible enhancement mechanism.
Changes without clutter from the clean slate commit can be found here.
Goals
Formatting
Enhancements
modify
method.except
enhancement.only
enhancement.Miscellaneous
Notes
append
enhancement is being dropped.call
enhancement is being replaced by the coreenhance
method functionality which will power the enhancement mechanism.replace
enhancement is being dropped.