Created
March 29, 2022 12:12
-
-
Save bran921007/0b0a1d2518a3d06874dfc0083983c5a5 to your computer and use it in GitHub Desktop.
retrieve records between two timestamps in Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Post::whereBetween('published_at',[ | |
$request->from ?? '1970-01-01', | |
$request->to ?? today()->toDateTimeString(), | |
])->get(); | |
//source: https://twitter.com/ecrmnn/status/1508472237833297927 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment