在雄辩的情况下,我怎样才能跳过10行然后获得表格的其余部分?
User::skip(10)->all();
上述方法不起作用,但它可以让您了解我在寻找什么。
答案 0 :(得分:3)
试试这个:
$count = User::count();
$skip = 10;
User::skip($skip)->take($count - $skip)->get();
使用一个查询:
User::skip($skip)->take(18446744073709551615)->get();
这很难看,但它只是一个例子from official MySQL manual:
从特定偏移量检索所有行直到结果的末尾 设置,您可以使用一些大数字作为第二个参数。这个 语句检索从第96行到最后一行的所有行:
SELECT * FROM tbl LIMIT 95,18446744073709551615;
答案 1 :(得分:2)
尝试类似这样的工作肯定会......
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from MyGUI import module_window_GUI
class moduleWindow(QMainWindow, module_window_GUI.Ui_module_window):
my_signal = pyqtSignal()
def __init__(self):
QMainWindow.__init__(self)
module_window_GUI.Ui_module_window.__init__(self)
self.setupUI(self)
# the rest is not important
# what is important is th following function
def closeEvent(self, event):
# when the user closes this subwindow signal needs to
# be emitted so that the MainWindow class knows that
# it's been closed.
self.my_signal.emit()
event.accept()
答案 2 :(得分:1)
Laravel 5将Eloquent结果作为Collection返回。 所以你可以使用collenction函数 slice();
$users = User::get();
$slicedUsers = $users->slice(10);