So I'm using fractal transformer to prettify my User model json return (using laravel 5.3 + dingo api).
previously I was returning my user model like this:
return response()->success(compact('user'));
and the json was returned like this
{
"errors": false,
"data": {
"user": {
"id": 2,
"first_name": "
now I use a transformer, and return it like this:
return $this->response->item($user, new UserTransformer);
and the json looks like this:
{
"data": {
"id": 2,
"first_name": "Client",
"last_name": "Testing",
How do I wire things up with fractal to return the same structure as it was previously (all my unit tests expect the original format, and so they're failing like this:
1) LoginEmailTest::testLoginEmailSuccess
Unable to find JSON fragment
["errors":false]
within
[{"data":[{"user":{"a
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire