Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function search_result($constructors,$min,$max,$page){
- $constructor_array = array();
- foreach ($constructors as $constructor):
- $constructor_array[] = $constructor['constructor_id'];
- endforeach;
- return Model_Constructor::find(function($q) use($constructor_array,$min,$max,$page){
- return $q->select(
- 'name',
- 'description',
- 'constructors.id',
- 'min_price',
- 'max_price',
- 'count',
- 'header')
- ->where('constructors.id','in',$constructor_array)
- ->and_where('min_price','>=',$min)
- ->and_where('max_price','<=',$max)
- ->join('constructor_favorites','inner')
- ->on('constructors.id','=','constructor_favorites.constructor_id')
- ->limit($page->per_page)
- ->offset($page->offset)
- ->order_by('count','desc');
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement