In this tutorial you will learn about the Laravel Eloquent whereTime Query Example and its application with practical example.
In this Laravel Eloquent whereTime Query Example tutorial I’ll show you how to use eloquent method with laravel query builder and model.
Laravel Eloquent whereTime Query Example
While working with laravel database you want query records of specific time only. In this case laravel whereTime() method is very helpful to query records with specific time. In this tutorial we will demonstrate the various example of laravel whereTime method:
Laravel whereTime method with query builder
In this example we will be using whereTime method with laravel query builder as following:
1 2 3 4 |
$users = DB::table('users') ->whereTime('created_at', '=', '09:50:11') ->get(); dd($users); |
Laravel whereTime method with eloquent model
In this example we will be using laravel whereTime method with eloquent model as following:
1 2 3 |
$users = User::whereTime('created_at', '=', '09:50:11') ->get(); dd($users); |
you can also write this whereTime query without operator as follow:
1 2 |
$users = User::whereTime('created_at1', '09:50:11')->get(); dd($users); |