How to select 3 records before x ID and 5 records after x ID with Laravel Eloquent? How can I select 3 records before x ID and 5 records after x ID with Laravel Eloquent or mysql?
(" or mysql")

( SELECT ... FROM ...
        WHERE id &lt; x ORDER BY id DESC LIMIT 3 )
UNION ALL
( SELECT ... FROM ...
        WHERE id &gt; x ORDER BY id ASC LIMIT 5 )
ORDER BY id   -- optional


If you want to include id=x, then change &lt; to &lt;= or &gt; to &gt;=.

How to turn that into Laravel?  I don't know.  Maybe you will need something clumsier.