Level 75
$users = User::whereYear('created_at', 2019)->get();
// or
$users = User::whereYear('created_at', '>=', 2019)->get();
Docs: https://laravel.com/docs/8.x/queries#additional-where-clauses (look for whereYear)
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello! How to remove data from the database from 2019? and those that are not displayed later
p.s sorry, do not delete, but show from 2019
$users = User::whereYear('created_at', 2019)->get();
// or
$users = User::whereYear('created_at', '>=', 2019)->get();
Docs: https://laravel.com/docs/8.x/queries#additional-where-clauses (look for whereYear)
Please or to participate in this conversation.