Skip to content

Instantly share code, notes, and snippets.

@vineeth030
Last active May 29, 2020 05:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vineeth030/e88ab4dbdb46f4ae00efae161f6d8a95 to your computer and use it in GitHub Desktop.
Save vineeth030/e88ab4dbdb46f4ae00efae161f6d8a95 to your computer and use it in GitHub Desktop.
<?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