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

Recommended route name conflict? #155

Open
benjivm opened this issue Oct 26, 2022 · 0 comments
Open

Recommended route name conflict? #155

benjivm opened this issue Oct 26, 2022 · 0 comments

Comments

@benjivm
Copy link

benjivm commented Oct 26, 2022

The recommended route naming convention is snake_case with dot notation: https://github.com/alexeymezenin/laravel-best-practices#follow-laravel-naming-conventions

However, Laravel itself follows the casing of the resource when generating multi-word route resource names, and kebab-case in its own support packages (e.g., Sanctum):

Route::resource('my-complex-resource', MyComplexResourceController::class);
Route::resource('my_complex_resource', MyComplexResourceController::class);
Route::resource('myComplexResource', MyComplexResourceController::class);
GET|HEAD        my-complex-resource ............................. my-complex-resource.index › MyComplexResourceController@index
POST            my-complex-resource ............................. my-complex-resource.store › MyComplexResourceController@store
GET|HEAD        my-complex-resource/create .................... my-complex-resource.create › MyComplexResourceController@create
GET|HEAD        my-complex-resource/{my_complex_resource} ......... my-complex-resource.show › MyComplexResourceController@show
PUT|PATCH       my-complex-resource/{my_complex_resource} ..... my-complex-resource.update › MyComplexResourceController@update
DELETE          my-complex-resource/{my_complex_resource} ... my-complex-resource.destroy › MyComplexResourceController@destroy
GET|HEAD        my-complex-resource/{my_complex_resource}/edit .... my-complex-resource.edit › MyComplexResourceController@edit
GET|HEAD        myComplexResource ................................. myComplexResource.index › MyComplexResourceController@index
POST            myComplexResource ................................. myComplexResource.store › MyComplexResourceController@store
GET|HEAD        myComplexResource/create ........................ myComplexResource.create › MyComplexResourceController@create
GET|HEAD        myComplexResource/{myComplexResource} ............... myComplexResource.show › MyComplexResourceController@show
PUT|PATCH       myComplexResource/{myComplexResource} ........... myComplexResource.update › MyComplexResourceController@update
DELETE          myComplexResource/{myComplexResource} ......... myComplexResource.destroy › MyComplexResourceController@destroy
GET|HEAD        myComplexResource/{myComplexResource}/edit .......... myComplexResource.edit › MyComplexResourceController@edit
GET|HEAD        my_complex_resource ............................. my_complex_resource.index › MyComplexResourceController@index
POST            my_complex_resource ............................. my_complex_resource.store › MyComplexResourceController@store
GET|HEAD        my_complex_resource/create .................... my_complex_resource.create › MyComplexResourceController@create
GET|HEAD        my_complex_resource/{my_complex_resource} ......... my_complex_resource.show › MyComplexResourceController@show
PUT|PATCH       my_complex_resource/{my_complex_resource} ..... my_complex_resource.update › MyComplexResourceController@update
DELETE          my_complex_resource/{my_complex_resource} ... my_complex_resource.destroy › MyComplexResourceController@destroy
GET|HEAD        my_complex_resource/{my_complex_resource}/edit .... my_complex_resource.edit › MyComplexResourceController@edit
GET|HEAD        sanctum/csrf-cookie ......................... sanctum.csrf-cookie › Laravel\Sanctum › CsrfCookieController@show

And since kebab-case is the accepted URI convention shouldn't it also be the named route convention?

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

No branches or pull requests

1 participant