Laravel Eloquent whereTime() Query Example; In this tutorial you will learn how to use whereTime query builder and model in laravel. The whereTime method may be used to compare a column’s value against a specific time. If you want to get a specific time records in laravel then you just use the whereTime query.
Here you will see best examples of laravel whereTime method:
Example 1:
use App\Models\User;
class UserController extends Controller
{
public function index()
{
$time = '11:20:45';
$users = User::whereTime('created_at', '=', $time)
->get();
dd($users);
}
}
Example 2:
use App\Models\User;
class UserController extends Controller
{
public function index()
{
$time = '11:20:45';
$users = User::whereTime('created_at', '>=', $time)
->get();
dd($users);
}
}
I hope this will work for you…