Skip to content

Instantly share code, notes, and snippets.

@joetannenbaum
Last active February 6, 2017 17:20
Show Gist options
  • Save joetannenbaum/cf6edd15608fb2a49a0fbb79ab7e9981 to your computer and use it in GitHub Desktop.
Save joetannenbaum/cf6edd15608fb2a49a0fbb79ab7e9981 to your computer and use it in GitHub Desktop.
<?php
class UserTransformer extends TransformerAbstract
{
public function transform(User $user)
{
return [
// Make sure to hash any IDs before returning
'id' => Hasher::encode($user->id),
'first_name' => $user->first_name,
'last_name' => $user->last_name,
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment