Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel naming conventions

Gegasoft uses the following name conventions for laravel
=============================================================
Variables	=>	camelCase	=>	$articlesWithAuthor
Collection Variable	=>	descriptive, plural	=>	$activeUsers = User::active()->get()
Object Variable	=>	descriptive, singular	=>	$activeUser = User::active()->first()
View	=>	snake_case	=>	show_filtered.blade.php
Controllers	=>	singular, ProperCase	=>	ArticleController
Model Name	=>	singular, ProperCase	=>	User, FollowingRequest
Model attribute/property	=>	snake_case	=>	$model->created_at
Method	=>	camelCase	=>	getAll
Method in resource controller	=>	table	=>	store
Method in test class	=>	camelCase	=>	testGuestCannotSeeArticle
hasOne/belongsTo relation	=>	singular	=>	articleComment
Other relations	=>	plural	=>	articleComments
Table Name =>	plural	=>	article_comments
Table column	=>	snake_case without model name	=>	meta_title
Route	=>	plural	=>	articles/1
Named route	=>	snake_case with dot notation	=>	users.show_active
Primary key	=>	-	=>	id
Foreign key	=>	singular model name with _id suffix	=>	article_id
Pivot table	=>	singular model names in alphabetical order	=>	article_user
Migration	=>	-	=>	2017_01_01_000000_create_articles_table
Config and language files index	=>	snake_case	=>	articles_enabled
Config	=>	snake_case	=>	google_calendar.php
Contract (interface)	=>	adjective or noun	=>	Authenticatable
Trait	=>	adjective	=>	Notifiable
Comment

PREVIOUS NEXT
Code Example
Php :: php str_replace multiple 
Php :: convert object to array php 
Php :: remove special character in php 
Php :: strpos in python 
Php :: wpml language switcher shortcode 
Php :: select sum in laravel 
Php :: Deprecated Functionality: stripos() 
Php :: indian time laravel 
Php :: laravel checkbox terms and conditions 
Php :: write file in php 
Php :: cakephp order by 
Php :: php artisan preset react 
Php :: php redirect to page 
Php :: laravel base url 
Php :: get current user email wordpress 
Php :: open php ini from terminal 
Php :: php serve 
Php :: artisan refresh 
Php :: php favicon 
Php :: laravel vue csrf 
Php :: convert stdclass object to array php 
Php :: limit offset array php 
Php :: how to add woocommerce cart counter 
Php :: explode function in laravel 
Php :: how to one increment after post in laravel collective 
Php :: file_get_contents url fail 
Php :: Notice: Undefined property: enable_for_virtual 
Php :: laravel create password hash 
Php :: Install the php_mysql extensions 
Php :: Numbers Formater Decimal & Thousand Separator PHP 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =