I had to create this ID decoder to have my code compatible with https://github.com/michaeldyrynda/laravel-efficient-uuid. Maybe somebody will find this useful. ` <?php namespace App\JsonApi\Fields; use LaravelJsonApi\Contracts\Schema\IdEncoder; use LaravelJsonApi\Eloquent\Fields\ID; class EfficientUuidEncodedId extends ID implements IdEncoder { /** * Encode the model key to a JSON:API resource ID. * * @param string|int $modelKey * @return string */ public function encode($modelKey): string { // encode the model key - no need, auto casting return $modelKey; } /** * Decode the JSON:API resource ID to a model key (id). * * Implementations must return `null` if the value cannot be * decoded to a model key. * * @param string $resourceId * @return string|int|null */ public function decode(string $resourceId): int|string|null { // decode the JSON:API resource id return uuid2bin($resourceId); } } `