How to name controller folders, singnular or plural?

Published 2 months ago by maxnb

How to name controller folder using singular or plural?

for example Controllers/User/RoleController or Controllers/Users/RoleController

Best Answer (As Selected By maxnb)
Cronix

I don't think the directory name matters at all. Like in Laravel Spark, Taylor is using both singular and plural names for different controller directories...

Like, there's

/Auth
/Kiosk
/Settings

Even in the docs, it shows using a plural as an example in the "Controllers and Namespaces" section. https://laravel.com/docs/5.4/controllers App\Http\Controllers\Photos\AdminController

jlrdw
jlrdw
2 months ago (147,910 XP)

Name everything exactly like Taylor does in the examples and the documentation. They are named that way for a reason.

maxnb
maxnb
2 months ago (21,490 XP)

aaaaaand what does it name them like singular or plural?

philippe
jlrdw
jlrdw
2 months ago (147,910 XP)

With a vast number of videos available for free and all the examples in the documentation I won't even go there. You do realize some of the intro videos are absolutely free no cost to you as in free.

Cronix

I don't think the directory name matters at all. Like in Laravel Spark, Taylor is using both singular and plural names for different controller directories...

Like, there's

/Auth
/Kiosk
/Settings

Even in the docs, it shows using a plural as an example in the "Controllers and Namespaces" section. https://laravel.com/docs/5.4/controllers App\Http\Controllers\Photos\AdminController

jlrdw
jlrdw
2 months ago (147,910 XP)

Like aaaaand https://laravel.com/docs/5.4/eloquent#eloquent-model-conventions an example of the actual documentation.

maxnb
maxnb
2 months ago (21,490 XP)

Aaaaand the award goes to @Cronix, that is that answer I was looking for. So Taylor likes to mix it up, I guess I will go with plural for namespaces

maxnb
maxnb
2 months ago (21,490 XP)

@jlrdw

You do realize some of the intro videos are absolutely free no cost to you as in free.

I have watched lots of laravel videos, but I have a short memory and right now I am working on a bigger project where I like to organize stuff more, I came here to forum to get quick answer, instead of checking gazillion videos to see what everyone else is using :)

1 second is all it takes you to type what you are using and that is what I was looking for.

Cronix

@jlrdw He's asking about naming controller subdirectories though, not the actual model name.

maxnb
maxnb
2 months ago (21,490 XP)

@Cronix thanks, for model names I know that we use singular but I was thinking of using plural for subdirectories and wanted to know if everyone else was using it and what the preferred way was, thanks for your great answer :)

jlrdw
jlrdw
2 months ago (147,910 XP)

It wasn't great, it was grrrrrrreat.

Sign In or create a forum account to participate in this discussion.