Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix resource method names #32

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

ricventu
Copy link
Contributor

Hi
i made this PR to solve the issue #31

@ricventu
Copy link
Contributor Author

ricventu commented Nov 27, 2024

This will create routes names:

  GET|HEAD        users ............................................................. users › UsersController@index
  POST            users ....................................................... users.store › UsersController@store
  PUT|PATCH       users/{user} .............................................. users.update › UsersController@update
  DELETE          users/{user} ............................................ users.destroy › UsersController@destroy

@freekmurze
Copy link
Member

Could you add a test to ensure that this works?

@ricventu
Copy link
Contributor Author

I had previously updated the test will register routes with the correct http verbs for resourceful methods by adding the route name.
Now I've also added the test will register routes with the correct names for resourceful methods without adding already existing name for uri to verify that when a URI is specified with the same name, the name is not duplicated. This is because to address this issue, the URI could be specified through Route uri, which would also generate the name. In this case, the name was being duplicated, but with this modification, it is filtered if it's duplicate at the end of the name.

The errors reported by phpstan are not caused by these PR and are also present in the main branch.

@freekmurze freekmurze merged commit c20d263 into spatie:main Dec 11, 2024
18 of 19 checks passed
@freekmurze
Copy link
Member

Thanks!

@ricventu ricventu deleted the fix-resource-method-names branch December 11, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants