根据最高和最低价格Laravel 5获取属性

时间:2016-03-04 07:46:49

标签: database controller laravel-5

您好我有2个Dropdown一个来自Maximun Price,另一个来自最低价格,我正在尝试从数据库中过滤数据假设我有4条价格记录(20000,40000,60000,80000),当用户点击60000我想要显示小于等于数据,所以结果会像这样(20000,40000,60000)。 这是我的控制器

std::string

1 个答案:

答案 0 :(得分:0)

在我的控制器中,我的查询不正确,但现在一切都很好

//Minimum Price search
  public function min_price()
  {
    $term=Input::get('min');

    $display = DB::table('property_details')
                ->where('property_price', '>=', $term)
                ->Where('sale_or_rent', '=', 'sale')
                ->get();

                //var_dump($display); 
               if(count($display)!=0)
             {    
               $returnHTML = view('/pages/right_side_area')->with('row', $display)->render();
               return response()->json(array('success' => true, 'html'=>$returnHTML));
             }
              else
              {
               session::flash('status', 'No Records Found!!!');
               $returnHTML = view('/pages/right_side_area')->with('row', $display)->render();
               return response()->json(array('success' => true, 'html'=>$returnHTML));
             }
           }    
Hope it will helps other people..
相关问题