blueprint icon indicating copy to clipboard operation
blueprint copied to clipboard

Allow plural route naming convention

Open pktharindu opened this issue 3 years ago • 1 comments

Synopsis:

First of all, thank you so much for this amazing package! It saves me a ton of time.

I'm not sure whether this is intentional, but according to Laravel and REST naming conventions, the route URIs should be in plural form.

Refferences:

  • https://github.com/alexeymezenin/laravel-best-practices#follow-laravel-naming-conventions
  • https://restfulapi.net/resource-naming/
  • https://laravel.com/docs/8.x/controllers#resource-controllers

Proposed Syntax:

Expected Behavior:

Currently, the generated routes are in the singular form. For example:

controllers:
  Post:
    resource: api

Generates:

Route::apiResource('post', App\Http\Controllers\PostController::class);

Instead, it should be:

Route::apiResource('posts', App\Http\Controllers\PostController::class);

pktharindu avatar Jun 10 '21 08:06 pktharindu

I am open to adding a configuration option for generating plural routes, view, etc. However, per the previous PR, this is not a small task. I will leave this open for the community to implement if wanted.

jasonmccreary avatar Jun 16 '21 02:06 jasonmccreary

Merged in #574

jasonmccreary avatar Oct 05 '22 17:10 jasonmccreary