Hello,
I'm try to upgrade from laravel 5.8 to laravel 6 and stay with backpack version 3.6.33 (our project is large and the transition to backpack 4 is complex :wink: ) and I'have strange issue
Now, when I use
route ('crud.opportunity.edit', ['id' => 'x'])
I have the following error:
_Missing required parameters for [Route: crud.opportunity.edit] [URI: opportunity / {opportunity} / edit]_
But with
route ('crud.opportunity.edit', ['opportunity' => 'x'])
That's work fine
Do you have some idea why the required parameter name have changed?
Thanks for your help
Hello there! Thanks for opening your first issue on this repo!
Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.
Backpack communication channels:
backpack-for-laravel tag;Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.
Thank you!
--
Justin Case
The Backpack Robot
Hello @yvesnetalis
Indeed I allways used the parameter name in route() helper as the same name in route, and from laravel documentation that's how it's supposed to work: https://laravel.com/docs/7.x/routing#required-parameters
This is not something we can help you with, nor a Backpack bug. You might want to look for Laravel upgrade guide for references about it or whatever you can find, but my best advise to you is just to fix it. I think that's the way it's supposed to work.
Best,
Pedro
Hello @pxpm
Thank you to your answer
I had read Laravel's upgrade page but it didn't help much. I have not found what has changed in Laravel's code.
But I found how to fix this in backpack :smile:
In crud/src/CrudRouter.php, I added the following code on $options_with_defaut_route_names array
'parameters' => [
$this->name => 'id',
]

Problem solved !
Have a good day,
Yves
(https://laravel.com/docs/6.x/controllers#restful-naming-resource-route-parameters)
Well done @yvesnetalis very nice and clean solution.
Thank you very much for making it public, it might help someone that struggles with same problem.
Best,
Pedro