Skip to content

konnco/laravel-code-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Konnco Studio - Laravel Code Style

Introduction

Maybe many of the new kids who applied at Konnco Studio are a little confused about how to write laravel code at Konnco Studio, so please read this document carefully.

Coding Style

Variables

Always use camel case to write variables

$order_detail; // BIG NO!
$OrderDetail; // BIG NO!
$orderDetail; // BIG NO!

Controllers

Models

Jika kamu sering menggunakan suatu filter sebagai contoh status publish kamu bisa menambahkan scope publish pada modelmu, sebagai contoh :

Class Post extends Model {
    public function scopeWherePublished($query){
        return $query->where('status','PUBLISHED');
    }
}
$post = Post::wherePublished()->get();

Jobs

Routings

Always use the import class, to make it easier for the IDE to identify files, and also make it easier for you to open the controller in use.

Route::resource('payment', OrderApiController::class]);
Route::get('payment', [OrderApiController::class, 'index']);

Etc

Try to avoid unnecessary nesting by returning a value early

Return Early

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published