Laravel5响应"HTTP状态代码"1"无效."

9 php symfony laravel laravel-4 laravel-5

我有大而简单的大数据连接查询.如果我打印查询结果使用dd()var_dump()我得到结果,但如果我传递结果数据或重定向我得到一个例外

"HTTP状态代码"1"无效."

这是行动代码:

public function postSearch(Request $request)
{
    $min_price  = !empty($request['min_price']) ? $request['min_price'] : 500;
    $max_price  = !empty($request['max_price']) ? $request['max_price'] : 50000000000;

    $properties = DB::table('properties')
                ->join('addresses', function($join) {
                    $join->on('properties.id', '=', 'addresses.property_id');
                })
                ->where('status', '=', 1)
                ->where('category', '=', $request['search_category'])
                ->where('type', '=', $request['contract'])
                ->where('city', '=', $request['search_city'])
                ->where('area', '=', $request['property_area'])
                ->where('bed_room', '=', $request['search_bedroom'])
                ->where('bath_room', '=', $request['bath_room'])
                ->whereBetween('price', [$min_price, $max_price])
                ->orderBy('properties.updated_at', 'desc')
                ->paginate(15);
    try {
        if(!empty($properties))
        {
            return Redirect::to('property/search', compact('properties'));
        }
        else
        {
            return Redirect::to('/')->with('message', PropertyHelper::formatMessage(trans('property.property_not_found'), 'danger'));
        }
    }
    catch(\Exception $ex) {
        dd($ex->getMessage());
    }

}
Run Code Online (Sandbox Code Playgroud)

min*_*noz 24

我想你试着在搜索后显示搜索结果.问题是这一行.

return Redirect::to('property/search', compact('properties'));
Run Code Online (Sandbox Code Playgroud)

获得搜索结果后,您应该调用视图,而不是重定向.

return view('property.search', compact('properties'));
Run Code Online (Sandbox Code Playgroud)

但请确保您拥有视图文件.

资源