Naming Things
What | Penulisan | Contoh |
---|---|---|
Variable | camelCase | $userId |
Class property | camelCase | private $accessToken |
Class method | camelCase | $postRepository->featuredArticle() |
Global helper | snake_case | format_rupiah() |
Model | StudlyCase Kata Benda |
User UserProfile |
View file | kebab-case | laporan-harian.blade.php |
View file (partial) | kebab-case diawali underscore | _tabel-pegawai.blade.php |
Resource controller | StudlyCase Kata Benda Sufiks Controller |
UserController BukuTamuController |
Single action controller | StudlyCase Kata Kerja Sufiks Controller |
ClearCacheController LogoutController DownloadLaporanHarianController |
Route URL | kebab-case | https://javan.co.id/lowongan-kerja |
Route name | kebab-case Antara resource dan action dipisahkan dot (".") |
Route::get('lowongan-kerja', 'LowonganKerjaController@index')->name('lowongan-kerja.index'); |
Route parameter | camelCase | Route::get('lowongan-kerja/{lowonganKerja}', 'LowonganKerjaController@index'); |
Config file | kebab-case | config/dynamic-form.php |
Config key | snake_case | 'allowed_types' => ['text', 'textarea', 'select’] |
Artisan command | kebab-case | php artisan generate-laporan |
Table name | snake_case Kata Benda Bisa diberi prefik untuk grouping |
pegawai master_provinsi master_kabupaten |