I don't think that the DB::table query would use global scopes or not but have tried something like this on the eloquent queries?
// Remove all of the global scopes...
Post::withoutGlobalScopes()->get();
In case you have soft deletes configured?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi guys,
I am facing a strange problem and I can't figure out what's wrong. I have a database with posts table which contains more than 13 000 rows. When I manually try to make an SQL query and select some records, everything works fine.
Now when I start the server and try to make a query I can't get all the records. To be specific, I've just got 10 922 records from 13 317. Where are those 2K records?
This is not a regular database I've made with Laravel, it's Wordpress and I am also using Corcel package, but it's really strange that I can't get all the records. It seems like something is blocking the query to run over all of the rows, but even when I tried to delete some records after the record 10 922, nothing has changed. The records are there but I just can't get them.
Post::all();
Post::status('publish')->get();
DB::table('posts')->get();
I tried it with pagination, orderBy different columns, limit and everything else I know when it comes to querying the DB.
I cleared cache, restart the server and everything else, but the result is same. Are there other procedures that I've forgot to do? Thanks in advance.
Finally! I've got it working and really don't know how.
I wipe out all the tables, then made a backup of live DB and made a big cleanup (delete all revisions, empty rows and so on (wordpress database is really a junk full of craps after time). Then I've just imported this let's say less uglier database and it's working. Oh, now I can go rest with peace in my mind.
Thanks everyone for participating and time, especially you @Cronix
Please or to participate in this conversation.