php-api-wrapper
php-api-wrapper copied to clipboard
Related resource id
What is the motivation behind this localKey
attribute ?
https://github.com/CristalTeam/php-api-wrapper/blob/4f52883e250b8ea4b38c7c6b09d0ead6a0c562cb/src/Bridges/Laravel/Relations/HasMany.php#L23
I have created my database and models the Laravel's way and my relationships keys looks like "relatedModel_id" more than "id". Hence, it is working if I change the previously mentioned line to:
$this->localKey = Str::singular($this->parent->getEntity()) . '_' . $localKey;
Also, is this package intended to be used with the JSON:API specifications ? My remote API is using these specifications and I have to change the line to (according to https://jsonapi.org/format/#fetching-filtering):
$this->localKey = 'filter[' . Str::singular($this->parent->getEntity()) . '_' . $localKey . ']';