Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
laravel分页中下一页的空白页_Laravel - Fatal编程技术网

laravel分页中下一页的空白页

laravel分页中下一页的空白页,laravel,Laravel,laravel中的分页是在除第一页以外的其他页中显示空白页 below is controller $products=DB::table('products')->join('mobile_devices', 'products.id', '=', 'mobile_devices.product_id')->where('mobile_devices.brand', '=',$request->brand) ->where('mobile_de

laravel中的分页是在除第一页以外的其他页中显示空白页

below is controller

$products=DB::table('products')->join('mobile_devices', 'products.id', '=', 'mobile_devices.product_id')->where('mobile_devices.brand', '=',$request->brand)
            ->where('mobile_devices.ram', '=', $request->ram)
            ->where('mobile_devices.storage', '=',$request->storage )
            ->select('products.*')->paginate(15);

below is blade
<div class="product-filter product-filter-bottom filters-panel">
                    <div class="row">
                        <div class="col-sm-6 text-left"></div>
                        <div class="col-sm-6 text-right">{{$products->links()}}</div>
                    </div>
                </div>

working fine in eloquent result but in query result the problem is occuring. The first page is shown but in other pages just blank page appears
下面是控制器
$products=DB::table('products')->join('mobile_devices','products.id','=','mobile_devices.product_id')->其中('mobile_devices.brand','=','request->brand)
->其中('mobile_devices.ram','=',$request->ram)
->其中('mobile_devices.storage','=',$request->storage)
->选择('products.*')->paginate(15);
下面是刀片
{{$products->links()}
在雄辩的结果中工作良好,但在查询结果中问题正在发生。显示第一页,但在其他页面中仅显示空白页

在您的视图中,像这样使用集合/结果

 @foreach($products as $product)
   {{$product->name}} // whatever you want to display
 @endforeach
 {{$products->links()}} // use the exact name of the object that you are passed to the view

属性
request->ram
$request->storage
是否结转到分页链接?如果你不加入它们,它们可能不会。请参阅位于的文档中的“附加到分页链接”


另请参见

ya ram,存储必须传递到下一页。我这样做了{{$users->appends(['sort'=>'vowers'])->links()}按照文档的说明这样做,但问题仍然没有解决。我在筛选产品页面后遇到了这个问题。url如下所示。这是您网站的第一页,下一个链接的url是“”。变量不在查询字符串中。它应该是“”,如果你没有同时填写
brand\u id
brand
query变量,那么你的控制器就会坏掉。我是作为{!!$products->appends(request::except('page')->render()!!}完成的,它可以工作……感谢你的即时响应检查你是否通过放置
dd来获得结果($产品)
$products = DB::table(...);
$products->appends([
    'ram' => $request->ram, 
    'storage' => $request->storage,
    'brand_id' => $request->brand_id,
    'brand' => $request->brand
]);