-
Notifications
You must be signed in to change notification settings - Fork 107
Closed
@lindyhopchris
Description
I just ran into this, and the issue is the first ID in a legacy database was set to 0, so this was always returning true: https://github.com/cloudcreativity/laravel-json-api/blob/develop/src/Object/IdentifiableTrait.php#L78
Fixed it for now by modifying the Schema::getId() method in my resource:
/**
* @param $resource
* the domain record being serialized.
*
* @return string
*/
public function getId( $resource )
{
$id = $resource->getRouteKey();
if( empty( $id ) ) {
$id = 1;
}
return (string) $id;
}
Originally posted by @defunctl in #368 (comment)