Closed contrerasojuanc closed 5 years ago
I'm not keen to add this because the method matches how it is implemented in this package. Saying that I've made that method protected
for a reason... i.e. to allow the developer to overload it with anything they want. I.e. the package already supports what you want to do via method overloading.
As a side note, I would not recommend making a generic schema. We used to do that but it is highly inefficient when serializing lots of records at once. While it might feel like you're making your life easier as a developer, you'll be slowing your API down a lot, and it's not worth that cost.
Thanks for the advice @lindyhopchris overriding that method works.
I'm trying to create a GenericAdapter (Also GenericSchema and GenericValidators) with magic method _call for relations, so, adding new models won't need any more code than the Eloquent models definition, but method methodForRelation on vendor/cloudcreativity/laravel-json-api/src/Adapter/AbstractResourceAdapter.php is using method_exists witch will return false as those relations methods are managed by the magic method. In this case, is it possible to change the methodForRelation on the library to something like?:
If it is possible, can I make the PR? If not, do we have any way to achive something similar?
Thanks