pipe-dream / laravel-file-factory

5 stars 5 forks source link

APIResourcePipe.js whenLoaded should be camelCase #21

Open axit-joost opened 4 years ago

axit-joost commented 4 years ago

Illuminate\Http\Resources\ConditionallyLoadsAttributes::whenLoaded takes the relationship string as a parameter. It should thus format as camelCase, not as snake_case, as can be observed on

https://github.com/pipe-dream/laravel-file-factory/blob/fb24540b47bf7493907b925d1f7aef26d17b521b/src/pipes/APIResourcePipe.js#L37

It can be reproduced by having hasMany relationships to a model that has more than one word, e.g. SomeName, will create a someName() hasMany relation, but in the current pipe, the whenLoaded() will try and load some_name, which is incorrect.