GithubHelp home page GithubHelp logo

build-an-api-with-laravel's Issues

Question regarding Unique Email Users

Inside jsonapi config, i found users validation rules email but without unique constraint, both create and update. I know how to add unique for create, but how to add unique constraint for update? how do i add user id into unique constraint? thanks

Configuration files are not serializable

Hi guys,

I've got an issue when trying to php artisan config:cache :

image

The issue is coming from jsonapi.php
'allowedFilters' => [Spatie\QueryBuilder\AllowedFilter::exact('roles', 'roles.name')]

Here is the content of the config file that does not work :

image

I think it's because there is a closure? Would you have an advice to bypass that?

P.S : I am using Laravel 6.0 et spatie querybuilder 2.3

Nice book btw :)

Unsupported grant type

I'm going through the book, when I encountered this error:
// 20200208154004
// http://annas-bookstore.test/oauth/authorize?client_id=4&redirect_uri=http%3A%2F%2Fpassport-oauth-client.test%2Fcallback&response_type=token&scope=

{
"error": "unsupported_grant_type",
"error_description": "The authorization grant type is not supported by the authorization server.",
"hint": "Check that all required parameters have been provided",
"message": "The authorization grant type is not supported by the authorization server."
}

Illuminate\Routing\Exceptions\UrlGenerationException Missing required parameters for [Route: books.relationships.authors] [URI: api/v1/books/{book}/relationships/authors].

I'm getting the following error when I test the relationships:
Illuminate\Routing\Exceptions\UrlGenerationException Missing required parameters for [Route: books.relationships.authors] [URI: api/v1/books/{book}/relationships/authors].

Detailed questing is asked below link: https://laracasts.com/discuss/channels/testing/illuminateroutingexceptionsurlgenerationexception-missing-required-parameters-for-route-booksrelationshipsauthors-uri-apiv1booksbookrelationshipsauthors

Laravel : 7.14.1

Regards,
Saneesh

Polymorphism

Hey guys
I wanted to know if this lib can manage polymorphism?
Have a great day

Unique constraint is not working from jsonapi config file

Hello,
After reading your book, I am trying to implement my own API. I am having an issue here,

I want something like this in jsonapi.php config file for shops table,
'data.attributes.name' => 'required|unique:shops|string'
but seems like it is not working. It is giving me 404 that means QueryException

I have also tried with this approach,

'data.attributes.name' => [
    'required',
    Illuminate\Validation\Rule::unique('shops'),
    'string'
]

But I got the serializing issue when running php artisan optimize command.

So how can I achieve this? All I want is a validation rule which will give me the error name already exists or something like that so that I can show in the frontend.

Thanks in advance.

Call to a member function first on null

Hi. I am faced with the above exception when trying to include some relationships (belongsTo) that can be null in some records from the database.
For example, customer can belongTo a branch.

I've tracked the cause to relations method on JSONAPIResource class.

private function relations()
    {
        return collect(config("core.resources.{$this->type()}.relationships"))->map(function($relation){
                $modelOrCollection = $this->whenLoaded($relation['method']);

                if($modelOrCollection instanceof Model){
                    $modelOrCollection = collect([new JSONAPIResource($modelOrCollection)]);
                }

                return JSONAPIResource::collection($modelOrCollection);
        });
    }

Here

$modelOrCollection = $this->whenLoaded($relation['method']);

returns null in such case which causes the error.

Test failing for BooksCollection Resource for the included top-level members

The following tests in the BooksRelationshipTest.php are failing:
it_includes_related_resource_objects_for_a_collection_when_an_include_query_param_is_given

with this error:

 Unable to find JSON:
[{
    "data": [
        {
            "id": "1",
            "type": "books",
            "attributes": {
                "title": "Dr. Freddie Kovacek",
                "description": "Ipsam eius harum nam.",
                "publication_year": "1982",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/1/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/1/authors"
                    },
                    "data": [
                        {
                            "id": "1",
                            "type": "authors"
                        },
                        {
                            "id": "2",
                            "type": "authors"
                        },
                        {
                            "id": "3",
                            "type": "authors"
                        }
                    ]
                }
            }
        },
        {
            "id": "2",
            "type": "books",
            "attributes": {
                "title": "Miss Aubree Bernier Sr.",
                "description": "Sed nulla tempora amet quod.",
                "publication_year": "1987",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/2/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/2/authors"
                    }
                }
            }
        },
        {
            "id": "3",
            "type": "books",
            "attributes": {
                "title": "Herman Bartoletti",
                "description": "Id beatae accusantium quam praesentium repellat ipsa maiores ut.",
                "publication_year": "1996",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/3/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/3/authors"
                    }
                }
            }
        }
    ],
    "included": [
        {
            "id": "1",
            "type": "authors",
            "attributes": {
                "first_name": "Terrance",
                "last_name": "Streich",
                "other_name": "Kohler",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            }
        },
        {
            "id": "2",
            "type": "authors",
            "attributes": {
                "first_name": "Emmitt",
                "last_name": "Walsh",
                "other_name": "O'Connell",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            }
        },
        {
            "id": "3",
            "type": "authors",
            "attributes": {
                "first_name": "Jeramy",
                "last_name": "Luettgen",
                "other_name": "Pacocha",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            }
        }
    ]
}]
within response JSON:
[{
    "data": [
        {
            "id": "1",
            "type": "books",
            "attributes": {
                "title": "Dr. Freddie Kovacek",
                "description": "Ipsam eius harum nam.",
                "publication_year": "1982",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/1/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/1/authors"
                    }
                }
            }
        },
        {
            "id": "2",
            "type": "books",
            "attributes": {
                "title": "Miss Aubree Bernier Sr.",
                "description": "Sed nulla tempora amet quod.",
                "publication_year": "1987",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/2/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/2/authors"
                    }
                }
            }
        },
        {
            "id": "3",
            "type": "books",
            "attributes": {
                "title": "Herman Bartoletti",
                "description": "Id beatae accusantium quam praesentium repellat ipsa maiores ut.",
                "publication_year": "1996",
                "created_at": "2020-06-06T22:23:22.000000Z",
                "updated_at": "2020-06-06T22:23:22.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/3/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/3/authors"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "http://annas-bookstore.test/api/v1/books?include=authors&page%5Bnumber%5D=1",
        "last": "http://annas-bookstore.test/api/v1/books?include=authors&page%5Bnumber%5D=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://annas-bookstore.test/api/v1/books",
        "per_page": 30,
        "to": 3,
        "total": 3
    }
}].
Failed asserting that an array has the subset Array &0 (
    'data' => Array &1 (
        0 => Array &2 (
            'id' => '1'
            'type' => 'books'
            'attributes' => Array &3 (
                'title' => 'Dr. Freddie Kovacek'
                'description' => 'Ipsam eius harum nam.'
                'publication_year' => '1982'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
            'relationships' => Array &4 (
                'authors' => Array &5 (
                    'links' => Array &6 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/1/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/1/authors'
                    )
                    'data' => Array &7 (
                        0 => Array &8 (
                            'id' => '1'
                            'type' => 'authors'
                        )
                        1 => Array &9 (
                            'id' => '2'
                            'type' => 'authors'
                        )
                        2 => Array &10 (
                            'id' => '3'
                            'type' => 'authors'
                        )
                    )
                )
            )
        )
        1 => Array &11 (
            'id' => '2'
            'type' => 'books'
            'attributes' => Array &12 (
                'title' => 'Miss Aubree Bernier Sr.'
                'description' => 'Sed nulla tempora amet quod.'
                'publication_year' => '1987'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
            'relationships' => Array &13 (
                'authors' => Array &14 (
                    'links' => Array &15 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/2/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/2/authors'
                    )
                )
            )
        )
        2 => Array &16 (
            'id' => '3'
            'type' => 'books'
            'attributes' => Array &17 (
                'title' => 'Herman Bartoletti'
                'description' => 'Id beatae accusantium quam praesentium repellat ipsa maiores ut.'
                'publication_year' => '1996'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
            'relationships' => Array &18 (
                'authors' => Array &19 (
                    'links' => Array &20 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/3/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/3/authors'
                    )
                )
            )
        )
    )
    'included' => Array &21 (
        0 => Array &22 (
            'id' => '1'
            'type' => 'authors'
            'attributes' => Array &23 (
                'first_name' => 'Terrance'
                'last_name' => 'Streich'
                'other_name' => 'Kohler'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
        )
        1 => Array &24 (
            'id' => '2'
            'type' => 'authors'
            'attributes' => Array &25 (
                'first_name' => 'Emmitt'
                'last_name' => 'Walsh'
                'other_name' => 'O'Connell'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
        )
        2 => Array &26 (
            'id' => '3'
            'type' => 'authors'
            'attributes' => Array &27 (
                'first_name' => 'Jeramy'
                'last_name' => 'Luettgen'
                'other_name' => 'Pacocha'
                'created_at' => '2020-06-06T22:23:22.000000Z'
                'updated_at' => '2020-06-06T22:23:22.000000Z'
            )
        )
    )
).
--- Expected
+++ Actual
@@ @@
             'self' => 'http://annas-bookstore.test/api/v1/books/1/relationships/authors',
             'related' => 'http://annas-bookstore.test/api/v1/books/1/authors',
           ),
-          'data' =>
-          array (
-            0 =>
-            array (
-              'id' => '1',
-              'type' => 'authors',
-            ),
-            1 =>
-            array (
-              'id' => '2',
-              'type' => 'authors',
-            ),
-            2 =>
-            array (
-              'id' => '3',
-              'type' => 'authors',
-            ),
-          ),
         ),
       ),
     ),
@@ @@
     'per_page' => 30,
     'to' => 3,
     'total' => 3,
-  ),
-  'included' =>
-  array (
-    0 =>
-    array (
-      'id' => '1',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Terrance',
-        'last_name' => 'Streich',
-        'other_name' => 'Kohler',
-        'created_at' => '2020-06-06T22:23:22.000000Z',
-        'updated_at' => '2020-06-06T22:23:22.000000Z',
-      ),
-    ),
-    1 =>
-    array (
-      'id' => '2',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Emmitt',
-        'last_name' => 'Walsh',
-        'other_name' => 'O\'Connell',
-        'created_at' => '2020-06-06T22:23:22.000000Z',
-        'updated_at' => '2020-06-06T22:23:22.000000Z',
-      ),
-    ),
-    2 =>
-    array (
-      'id' => '3',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Jeramy',
-        'last_name' => 'Luettgen',
-        'other_name' => 'Pacocha',
-        'created_at' => '2020-06-06T22:23:22.000000Z',
-        'updated_at' => '2020-06-06T22:23:22.000000Z',
-      ),
-    ),
   ),
 )

it_only_includes_a_related_resource_object_once_for_a_collection
with this error:

 Unable to find JSON:
[{
    "data": [
        {
            "id": "1",
            "type": "books",
            "attributes": {
                "title": "Prof. Baylee Morissette",
                "description": "Assumenda qui deleniti perferendis nihil architecto.",
                "publication_year": "2004",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/1/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/1/authors"
                    },
                    "data": [
                        {
                            "id": 1,
                            "type": "authors"
                        },
                        {
                            "id": 2,
                            "type": "authors"
                        },
                        {
                            "id": 3,
                            "type": "authors"
                        }
                    ]
                }
            }
        },
        {
            "id": "2",
            "type": "books",
            "attributes": {
                "title": "Idell Kilback V",
                "description": "Sed soluta eum corrupti blanditiis non ipsa rerum praesentium.",
                "publication_year": "1984",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/2/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/2/authors"
                    },
                    "data": [
                        {
                            "id": 1,
                            "type": "authors"
                        },
                        {
                            "id": 2,
                            "type": "authors"
                        },
                        {
                            "id": 3,
                            "type": "authors"
                        }
                    ]
                }
            }
        },
        {
            "id": "3",
            "type": "books",
            "attributes": {
                "title": "Delmer Padberg",
                "description": "Possimus aut dicta laudantium sint voluptates.",
                "publication_year": "2004",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/3/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/3/authors"
                    },
                    "data": [
                        {
                            "id": 1,
                            "type": "authors"
                        },
                        {
                            "id": 2,
                            "type": "authors"
                        },
                        {
                            "id": 3,
                            "type": "authors"
                        }
                    ]
                }
            }
        }
    ],
    "included": [
        {
            "id": "1",
            "type": "authors",
            "attributes": {
                "first_name": "Jefferey",
                "last_name": "Bradtke",
                "other_name": "Nikolaus",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            }
        },
        {
            "id": "2",
            "type": "authors",
            "attributes": {
                "first_name": "Randy",
                "last_name": "Bahringer",
                "other_name": "Trantow",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            }
        },
        {
            "id": "3",
            "type": "authors",
            "attributes": {
                "first_name": "Shannon",
                "last_name": "Quitzon",
                "other_name": "Von",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            }
        }
    ]
}]
within response JSON:
[{
    "data": [
        {
            "id": "1",
            "type": "books",
            "attributes": {
                "title": "Prof. Baylee Morissette",
                "description": "Assumenda qui deleniti perferendis nihil architecto.",
                "publication_year": "2004",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/1/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/1/authors"
                    }
                }
            }
        },
        {
            "id": "2",
            "type": "books",
            "attributes": {
                "title": "Idell Kilback V",
                "description": "Sed soluta eum corrupti blanditiis non ipsa rerum praesentium.",
                "publication_year": "1984",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/2/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/2/authors"
                    }
                }
            }
        },
        {
            "id": "3",
            "type": "books",
            "attributes": {
                "title": "Delmer Padberg",
                "description": "Possimus aut dicta laudantium sint voluptates.",
                "publication_year": "2004",
                "created_at": "2020-06-06T22:26:05.000000Z",
                "updated_at": "2020-06-06T22:26:05.000000Z"
            },
            "relationships": {
                "authors": {
                    "links": {
                        "self": "http://annas-bookstore.test/api/v1/books/3/relationships/authors",
                        "related": "http://annas-bookstore.test/api/v1/books/3/authors"
                    }
                }
            }
        }
    ],
    "links": {
        "first": "http://annas-bookstore.test/api/v1/books?include=authors&page%5Bnumber%5D=1",
        "last": "http://annas-bookstore.test/api/v1/books?include=authors&page%5Bnumber%5D=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://annas-bookstore.test/api/v1/books",
        "per_page": 30,
        "to": 3,
        "total": 3
    }
}].
Failed asserting that an array has the subset Array &0 (
    'data' => Array &1 (
        0 => Array &2 (
            'id' => '1'
            'type' => 'books'
            'attributes' => Array &3 (
                'title' => 'Prof. Baylee Morissette'
                'description' => 'Assumenda qui deleniti perferendis nihil architecto.'
                'publication_year' => '2004'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
            'relationships' => Array &4 (
                'authors' => Array &5 (
                    'links' => Array &6 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/1/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/1/authors'
                    )
                    'data' => Array &7 (
                        0 => Array &8 (
                            'id' => 1
                            'type' => 'authors'
                        )
                        1 => Array &9 (
                            'id' => 2
                            'type' => 'authors'
                        )
                        2 => Array &10 (
                            'id' => 3
                            'type' => 'authors'
                        )
                    )
                )
            )
        )
        1 => Array &11 (
            'id' => '2'
            'type' => 'books'
            'attributes' => Array &12 (
                'title' => 'Idell Kilback V'
                'description' => 'Sed soluta eum corrupti blanditiis non ipsa rerum praesentium.'
                'publication_year' => '1984'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
            'relationships' => Array &13 (
                'authors' => Array &14 (
                    'links' => Array &15 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/2/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/2/authors'
                    )
                    'data' => Array &16 (
                        0 => Array &17 (
                            'id' => 1
                            'type' => 'authors'
                        )
                        1 => Array &18 (
                            'id' => 2
                            'type' => 'authors'
                        )
                        2 => Array &19 (
                            'id' => 3
                            'type' => 'authors'
                        )
                    )
                )
            )
        )
        2 => Array &20 (
            'id' => '3'
            'type' => 'books'
            'attributes' => Array &21 (
                'title' => 'Delmer Padberg'
                'description' => 'Possimus aut dicta laudantium sint voluptates.'
                'publication_year' => '2004'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
            'relationships' => Array &22 (
                'authors' => Array &23 (
                    'links' => Array &24 (
                        'self' => 'http://annas-bookstore.test/api/v1/books/3/relationships/authors'
                        'related' => 'http://annas-bookstore.test/api/v1/books/3/authors'
                    )
                    'data' => Array &25 (
                        0 => Array &26 (
                            'id' => 1
                            'type' => 'authors'
                        )
                        1 => Array &27 (
                            'id' => 2
                            'type' => 'authors'
                        )
                        2 => Array &28 (
                            'id' => 3
                            'type' => 'authors'
                        )
                    )
                )
            )
        )
    )
    'included' => Array &29 (
        0 => Array &30 (
            'id' => '1'
            'type' => 'authors'
            'attributes' => Array &31 (
                'first_name' => 'Jefferey'
                'last_name' => 'Bradtke'
                'other_name' => 'Nikolaus'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
        )
        1 => Array &32 (
            'id' => '2'
            'type' => 'authors'
            'attributes' => Array &33 (
                'first_name' => 'Randy'
                'last_name' => 'Bahringer'
                'other_name' => 'Trantow'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
        )
        2 => Array &34 (
            'id' => '3'
            'type' => 'authors'
            'attributes' => Array &35 (
                'first_name' => 'Shannon'
                'last_name' => 'Quitzon'
                'other_name' => 'Von'
                'created_at' => '2020-06-06T22:26:05.000000Z'
                'updated_at' => '2020-06-06T22:26:05.000000Z'
            )
        )
    )
).
--- Expected
+++ Actual
@@ @@
             'self' => 'http://annas-bookstore.test/api/v1/books/1/relationships/authors',
             'related' => 'http://annas-bookstore.test/api/v1/books/1/authors',
           ),
-          'data' =>
-          array (
-            0 =>
-            array (
-              'id' => 1,
-              'type' => 'authors',
-            ),
-            1 =>
-            array (
-              'id' => 2,
-              'type' => 'authors',
-            ),
-            2 =>
-            array (
-              'id' => 3,
-              'type' => 'authors',
-            ),
-          ),
         ),
       ),
     ),
@@ @@
             'self' => 'http://annas-bookstore.test/api/v1/books/2/relationships/authors',
             'related' => 'http://annas-bookstore.test/api/v1/books/2/authors',
           ),
-          'data' =>
-          array (
-            0 =>
-            array (
-              'id' => 1,
-              'type' => 'authors',
-            ),
-            1 =>
-            array (
-              'id' => 2,
-              'type' => 'authors',
-            ),
-            2 =>
-            array (
-              'id' => 3,
-              'type' => 'authors',
-            ),
-          ),
         ),
       ),
     ),
@@ @@
             'self' => 'http://annas-bookstore.test/api/v1/books/3/relationships/authors',
             'related' => 'http://annas-bookstore.test/api/v1/books/3/authors',
           ),
-          'data' =>
-          array (
-            0 =>
-            array (
-              'id' => 1,
-              'type' => 'authors',
-            ),
-            1 =>
-            array (
-              'id' => 2,
-              'type' => 'authors',
-            ),
-            2 =>
-            array (
-              'id' => 3,
-              'type' => 'authors',
-            ),
-          ),
         ),
       ),
     ),
@@ @@
     'per_page' => 30,
     'to' => 3,
     'total' => 3,
-  ),
-  'included' =>
-  array (
-    0 =>
-    array (
-      'id' => '1',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Jefferey',
-        'last_name' => 'Bradtke',
-        'other_name' => 'Nikolaus',
-        'created_at' => '2020-06-06T22:26:05.000000Z',
-        'updated_at' => '2020-06-06T22:26:05.000000Z',
-      ),
-    ),
-    1 =>
-    array (
-      'id' => '2',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Randy',
-        'last_name' => 'Bahringer',
-        'other_name' => 'Trantow',
-        'created_at' => '2020-06-06T22:26:05.000000Z',
-        'updated_at' => '2020-06-06T22:26:05.000000Z',
-      ),
-    ),
-    2 =>
-    array (
-      'id' => '3',
-      'type' => 'authors',
-      'attributes' =>
-      array (
-        'first_name' => 'Shannon',
-        'last_name' => 'Quitzon',
-        'other_name' => 'Von',
-        'created_at' => '2020-06-06T22:26:05.000000Z',
-        'updated_at' => '2020-06-06T22:26:05.000000Z',
-      ),
-    ),
   ),
 )

This is the link to my repo.
Help will be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.