nafiesl / silsilah

A genealogy/family tree application, built with Laravel.
MIT License
577 stars 283 forks source link

Duplicate route names caused error on route caching #77

Closed yohanesgultom closed 2 years ago

yohanesgultom commented 2 years ago

Issue description

Duplicate route names caused error on route caching https://github.com/nafiesl/silsilah/blob/01524cdb1f60c9a29b136fce5a63e60de0d48814/routes/web.php#L19-L20

Steps to reproduce the issue

  1. Setup new instance from master branch
  2. Run command php artisan route:cache

What's the expected result?

Command successful without any error

What's the actual result?

Command failed with error below:

Command failed with error `Unable to prepare route [password/change] for serialization. Another route has already been assigned name [password.change].`

Additional details / screenshot

This can be easily fixed by renaming one of the route. But to ensure consistent naming convention, I think it's best left to the original author

nafiesl commented 2 years ago

Hello, @yohanesgultom thanks for reporting.

I can reproduce the issue from my localhost.

$ php artisan route:cache
Route cache cleared!

In AbstractRouteCollection.php line 217:

  Unable to prepare route [password/change] for serialization. Another route has already been assigned name [password.change].

Root cause: As mentioned above, the route names are identical.

Workaround:

I will work on it, this should be quick. Thanks, @yohanesgultom.

nafiesl commented 2 years ago

Hi, @yohanesgultom this commit should fix the issue 8afb010. You can now try to pull the latest changes on the master branch, then try to run the route:cache command again.

We can expect this result on the terminal:

$ php artisan route:cache
Route cache cleared!
Routes cached successfully!

Thanks.

yohanesgultom commented 2 years ago

@nafiesl it's working now. Thanks!