egeriis / laravel-jsonapi

Make it a breeze to create a jsonapi.org compliant APIs with Laravel 5.
MIT License
146 stars 27 forks source link

Hardcoded 'id' #2

Closed IAmJulianAcosta closed 9 years ago

IAmJulianAcosta commented 9 years ago

Sometimes the primary key of the models are not 'id', and I found that is being used this string instead of $primaryKey in some places.

Handler.php
      if (in_array($obj->id, $links->lists('id'))) continue;
Model.php
      $relations[$relation] = $value->id;
      /////////////////
      $relations[$relation] = array_pluck($value, 'id');
egeriis commented 9 years ago

Good spot @IAmJulianAcosta. Feel free to do a pull request?

IAmJulianAcosta commented 9 years ago

Created #3