为什么我只得到15个结果?我们有2万多个条目。
我的控制器:
namespace GBCustomer\Http\Controllers;
use GBCustomer\Customer;
use Illuminate\Http\Request;
class CustomerController extends Controller
{
public function listCustomers()
{
$customers = DB::table('customers')->paginate(10);
return view('customer.index',['customers' => $customers]);
}
}
我的路线
Route::get('/customer/list', 'CustomerController@listCustomers');
我的观点(部分)
<table id="datatable-buttons" class="table table-striped table-bordered"
cellspacing="0" width="100%">
<thead>
<tr>
<th>ID Customer</th>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
<tbody>
@foreach( $customers as $customer )
<tr role="row">
<td> <a href="customer/show/{{ $customer->id_customer }}">
{{ $customer->id_customer }} </a></td>
<td>{{ $customer->firstname }}</td>
<td>{{ $customer->lastname }}</td>
<td>{{ $customer->email }}</td>
</tr>
@endforeach
</tbody>
</table>
如果我把DB :: table('customers')-> paginate(1500);显示15个结果中的1500个结果。
如果我把DB :: table('customers')-> paginate(2000);显示15个结果中的2000个结果。
如果我把DB :: table('customers')-> paginate();显示15个结果中的15个结果。
如果我将此行更改为:
$ customers = Customer :: all();在一页上显示所有结果(大约22000)!
?¿?¿
预先感谢