Add limit and offset to the following code PHP LARAVEL SQL

Job ID: 35677407

Budget: $10 – $30 USD

Hello, I have the following php code, however it currently timeouts due to the size of my database so I'm wanting to do it in chunks.

Code: https://pastebin.com/C3DgFQik

I have tried the following without success:

$Posts = $this->db->from('posts')->where('type','serie')->limit(250)->get(); - ERROR 500

$Posts = $this->db->from('posts')->where('type','serie')->get(); - ERROR The get method was not found in the Database class.

$Posts = $this->db->from('posts')->where('type','serie')->offset(251)->limit(251)->get(); - ERROR The offset method was not found in the Database class.
Related categories: PHP MySQL Laravel