Reputation: 1130
What is the naming convention in Laravel for controllers? They should be singular or plural. I saw some people use singular and some people use plural for that. What is the correct form?
Upvotes: 40
Views: 26691
Reputation: 1125
You should follow those naming convention:
Class constants MUST be declared in all upper case with underscore separators; for example:
class Foo
{
const VERSION = '1.0';
const DATE_APPROVED = '2012-06-01';
}
Useful link:
https://www.php-fig.org/psr/psr-1/
Upvotes: 16
Reputation: 653
Plural. Although the official laravel docs use singular for controller names, it is very well known that most of prominent laravel developers such as Jeffrey Way, Adam Wathan, Chris Fidao and many others uses plural for controller names that it sort of become the actual standard.
You are far better off using plural so you feel less confusion when you watch their videos, read their blog posts.etc
Upvotes: 1