我用get和post搜索路线。第一次用户从主页中选择搜索过滤器,然后使用表单数据将其提交到索引控制器搜索,并在我点击页面时返回正确的分页结果,但不显示任何内容。
Route::post('search', 'SearchController@index');
Route::get('search', 'SearchController@index');
我有第一次发布的搜索索引控制器和这样的会话。
public function index(Request $request)
{
if( Request::get('select_menu') !='' ){
$conditions = array();
$conditions['city'] = Request::get('city');
$conditions['area'] = Request::get('area');
$conditions['purpose'] = Request::get('status');
$results = Property::where($conditions)->whereBetween('price', array(1000, 10000))->paginate(6);
Session::set('formDataSession', $conditions);
}
elseif(Session::has('formDataSession')){
$getSession = Session::get('formDataSession');
$conditions = array();
$conditions['city'] = $getSession['city'];
$conditions['area'] = $getSession['area'];
$conditions['purpose'] = $getSession['purpose'];
$results = Property::where($conditions)->whereBetween('price', array(1000, 10000))->paginate(6);
}
return view('search', array('page' => 'search','results'=>$results));
}
答案 0 :(得分:1)
'\0'