Skip to content

Dash in a resource route name breaks Route Model binding #12

@butcherman

Description

@butcherman

Describe the bug
When I have a resource route that has a dash in the name, route/model binding gets broken and an error "Missing required parameter for [Route....]"

What version does this affect?

  • Laravel Version: 9.38
  • Package Version: 1.6.0

To Reproduce
Setup a simple Resource Controller using Resource Breadcrumbs. Ex:
Route::resource('some-route', SomeRouteController::class)->breadcrumbs(function(ResourceBreadcrumbs $breadcrumbs) {
$breadcrumbs->index('Index Rte')->show('Show Rte')->edit('Edit Rte');
}

When trying to visit the Edit or Show routes and you will get the missing required parameter error.
Changing the - to an underscore will correct the error. Separating the resource route into individual routes will also correct the error.

Expected behavior
I use dashes in my route names on a regular basis as they are easy to read and match up with Laravel's slug method

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions