Open benjivm opened 2 years ago
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?
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):
And since kebab-case is the accepted URI convention shouldn't it also be the named route convention?