Last active
May 29, 2020 05:04
-
-
Save vineeth030/e88ab4dbdb46f4ae00efae161f6d8a95 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add scope methods in model class | |
public function scopeConditionOne($query) | |
{ | |
return $query->where('column_1', '=', 100); | |
} | |
public function scopeConditionTwo($query) | |
{ | |
return $query->where('column_2', '=', 100); | |
} | |
// Controller | |
$query->conditionOne()->conditionTwo()->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment