按多个选项筛选表

时间:2016-10-24 11:36:06

标签: php laravel filter

我有一些<select><option> foreach。我有

 <select class="form-control" name="agent" id="agent">
                        <option value="toti">All</option>
                        @foreach($values as $value)
                        <option value="{{$value->id_value}}">{{$value->val_name}}</option>
                        @endforeach 
                    </select>

 <div class="col-md-2">
    <select class="form-control" name="timp" id="timp">
        <option value="tot">All days</option>
        <option value="today">Today</option>
        <option value="7d">Last 7 days</option>
        <option value="30d">Last 30 days</option>
     </select>
  </div>




  <div class="col-md-2">
     <input type="text" placeholder="Data" class="form-control" value="Data" name="data" id="data" >
     <div class="input-group date">
     <input type="text" name="data_filt"  id="data_filt" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
  </div>

$id_user = Auth::user()->id();
$cars = Cars::whereFk_user($id_user)
  ->join('cars_my_cars', 'cars_my_cars.id_cars', '=', 'cars.fk_data_cars')
  ->join('cars_bill', 'partners_cars.id_date_partener', '=', 'cars.fk_date_partener')
  ->OrderBy('id_car', 'desc')->paginate(15);

  $agenti = Agent::whereFk_user($id_user)->get();
  $parteneri = Partener::whereFk_user($id_user)->OrderBy('name', 'asc')->get();

我希望用它来过滤Laravel中的表格。按代理人,按日期和日期。我将有这个3和一个按钮来提交选项...但我该怎么办呢?

0 个答案:

没有答案