I'm not sure if this is a bug or just lack of understanding on my part, as I'm fairly new to Laravel. I'm trying to implement this package in the Laravel app I'm building, but I'm running into an issue getting resource routing to work, in a case where the parent for the show route for one (nested) resource needs to be the show route for its parent resource. I can't find a way to define the breadcrumb for the child show route that loads without error.
What version does this affect?
Laravel Version: 10.34.2
Package Version: 1.7.0
To Reproduce
Here is the relevant excerpt from the routes/web.php file:
As you can see, I've tried three different alternatives of the show() function for the child resource. Neither works, but they give different errors when trying to access the child resource's show route:
Error: Illuminate\Routing\RouteFileRegistrar::{closure}(): Argument #1 ($ra) must be of type App\Models\RepositoryAccount, App\Models\Repository given, called in /app/vendor/glhd/gretel/src/Resolvers/Resolver.php on line 35
Error: Illuminate\Routing\RouteFileRegistrar::{closure}(): Argument #1 ($ra) must be of type App\Models\RepositoryAccount, App\Models\Repository given, called in /app/vendor/glhd/gretel/src/Resolvers/Resolver.php on line 35
Expected behavior
The child's show route loads successfully.
Additional context
It may be relevant that I'm also using slugs for my models' route keys, using Spatie's laravel-sluggable package, so the route for the show endpoint on my child resource resource looks like /repositories/active-directory/repository_accounts/abigailbruen. However, I've tested disabling the getRouteKey() definitions in both the parent and child model, which results in my route looking like /repositories/1/repository_accounts/9, and the problem still occurs.
I'm not sure if this is a bug or just lack of understanding on my part, as I'm fairly new to Laravel. I'm trying to implement this package in the Laravel app I'm building, but I'm running into an issue getting resource routing to work, in a case where the parent for the
show
route for one (nested) resource needs to be theshow
route for its parent resource. I can't find a way to define the breadcrumb for the childshow
route that loads without error.What version does this affect?
To Reproduce
Here is the relevant excerpt from the
routes/web.php
file:As you can see, I've tried three different alternatives of the
show()
function for the child resource. Neither works, but they give different errors when trying to access the child resource'sshow
route:Error:
Missing required parameter for [Route: repositories.repository_accounts.index] [URI: repositories/{repository}/repository_accounts] [Missing parameter: repository].
Error:
Illuminate\Routing\RouteFileRegistrar::{closure}(): Argument #1 ($ra) must be of type App\Models\RepositoryAccount, App\Models\Repository given, called in /app/vendor/glhd/gretel/src/Resolvers/Resolver.php on line 35
Error:
Illuminate\Routing\RouteFileRegistrar::{closure}(): Argument #1 ($ra) must be of type App\Models\RepositoryAccount, App\Models\Repository given, called in /app/vendor/glhd/gretel/src/Resolvers/Resolver.php on line 35
Expected behavior The child's
show
route loads successfully.Additional context
It may be relevant that I'm also using slugs for my models' route keys, using Spatie's
laravel-sluggable
package, so the route for theshow
endpoint on my child resource resource looks like/repositories/active-directory/repository_accounts/abigailbruen
. However, I've tested disabling thegetRouteKey()
definitions in both the parent and child model, which results in my route looking like/repositories/1/repository_accounts/9
, and the problem still occurs.