Laravel provides many additional methods other than standard methods. You might be familiar with where()
, orWhere()
, whereJsonContains()
or whereJsonLength()
. And these additional methods are worth checking.
In this article, we will see whereTime()
, one of the supplementary methods that comes in handy when you want to compare the table's field value with a specific time.
whereTime()
The whereTime()
method helps to get records matching the specific time.
Sytnax
whereTime('fieldName', 'operator', 'time');
- The first parameter is
fieldName
with which a comparison is to be done. - The second parameter is an
operator
for comparison, such as=
,<>
,>
,>=
,<
or<=
. - The third parameter is a
time
for comparison inHH:MM:SS
.
Example
$users = User::whereTime('login_at', '11:12:31')->get();
Read the complete post on our site Laravel's whereTime
Model Method
Read others post on our site MeshWorld
Happy ๐ coding
With โค๏ธ from ๐ฎ๐ณ
Top comments (0)