Skip to content

route model binding (Variable name cannot be longer than 32 characters in route pattern) #275

Open
@matthijs

Description

@matthijs

Hi,

Due to the naming of one of our resources the variable name became too long. (more then 32 characters)

Simplest solution was to short the variable name by using the following:

$server->resource('some-very-long-name-activities', '\\' . JsonApiController::class)
    ->parameter('short_name')
    ->readOnly();

Now when executing a request like:

GET /api/v1/some-very-long-name-activities/<id>

Now I get a 404 Not found. The record that I am trying to fetch exists.

Usual without laravel-json-api I fix this by using:

Route::model('short_name', SomeModel::class);

But due to the fact that laravel-json-api uses its own substitute bindings this does not seem to work.

The question now is: What am I missing?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions