Skip to content

Self-Link is wrong #314

Open
Open
@leo-unglaub

Description

@leo-unglaub

Hey,
i am having a problem where the self-link is wrong. All the first, last, next, ... links in the meta field are correct. But the self-link is ignoring the prefix() in the routes/api.php file.

Here is the link used to fetch all products from my API: http://127.0.0.1:8000/api/v1/foobar/products

The meta links are as follows:

Prev: http://127.0.0.1:8000/api/v1/foobar/products?page%5Bnumber%5D=1&page%5Bsize%5D=5
Next: http://127.0.0.1:8000/api/v1/foobar/products?page%5Bnumber%5D=3&page%5Bsize%5D=5

But the self Links look like this:

"links": {
    "self": "http:\/\/127.0.0.1:8000\/api\/v1\/products\/48418105884952"
}

Here is my routes/api.php file:

Route::name('v1.')
	->prefix('v1')
	->group(function () {
		Route::name('foobar.')
			->prefix('foobar')
			->group(function () {
				JsonApiRoute::server('v1')
					->resources(function (ResourceRegistrar $server) {
						$server
							->resource('company-internal-name-products', JsonApiController::class)
							->parameter('product')
							->readOnly();
						});
				});
	});

Is this a bug or did i do something wrong?
Thanks so much

Greetings
Leo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions