Skip to content

Instantly share code, notes, and snippets.

View AtiqurCode's full-sized avatar
🎯
Focusing

Md Atiqur Rahman AtiqurCode

🎯
Focusing
View GitHub Profile
@AtiqurCode
AtiqurCode / eloquent-cheatsheet.php
Created February 12, 2022 15:36 — forked from hassansin/eloquent-cheatsheet.php
Laravel 5 Eloquent CheatSheet #laravel #eloquent
Model::
/*Select*/
select('col1','col2')
->select(array('col1','col2'))
->select(DB::raw('businesses.*, COUNT(reviews.id) as no_of_ratings, IFNULL(sum(reviews.score),0) as rating'))
->addSelect('col3','col4')
->distinct() // distinct select
/*From*/