Laravel Multi属性搜索未按我的意愿进行过滤

What i want is when i select the start date and end date then press the search button.so that datas need to be get filtered.

Here is the interface.

enter image description hereHere is the relevant view for that.

<div class="col-md-12">
  <div class="jumbotron">
    <div class="col-md-offset-3">
      <div class="form-group">
        <form action="AdminpredictionSearch" method="post" class="form-inline">
          <div name="institute" id="institute">
            <div class="form-group">
              <label>Starting Date:</label>
              <input class="form-control" name="start_date" type="date" value="" id="example-date-input">
            </div>
            <div class="form-group">
              <label>End Date:</label>
              <input class="form-control" name="end_date" type="date" value="" id="example-date-input">
            </div>
            <input type="hidden" value="{{ csrf_token() }}" name="_token" />
            <input type="submit" name="submit" value="Search">
          </div>
        </form>
      </div>
    </div>
  </div>
</div>

Here is the Controller .

public function admin_predictions(Request $request)
{    
    $query = $request->search;
    $queryType = $request->institute; // 'id' or 'name'
    $items = DB::table('registerdetails');        

    if($queryType == 'start_date'){
        $items = $items->where('start_date', 'LIKE',"%$query%");
    }
    if($queryType == 'end_date'){
        $items = $items->where('end_date', 'LIKE',"%$query%");
    }
    $items = $items->get();

    return view('registeredusers.adminpredictions')->with('items',$items);
}

Here is the Route

Route::post('AdminpredictionSearch','UserRegisterController@admin_predictions');

Can anyone suggest me why is that not getting filtered.

  public function admin_predictions(Request $request)
{
    $start_date = Input::get('start_date');
    $end_date = Input::get('end_date');
    $items = DB::table('registerdetails');
    if ($start_date) {
        $items = $items->where('start_date', '=', $start_date);

    } elseif ($end_date) {
        $items = $items->where('end_date', '=', $end_date);
    } elseif ($start_date && $end_date) {
        $items = $items->where('end_date', '=', $end_date)->where('start_date', '=', $start_date);
    } else {

        $items = $items;
    }
    $items = $items->get();
    return view('registeredusers.adminsearch')->with('items', $items);
}

change the controller to this

    // here User is your model in controller
    //namespace App\Http\Controllers;
    //Use App\User;
    $search = 'foo';
    $user = User::where('name','LIKE',"%{$search}%")->get();
    print_r($user);