I have a weird issue-- my Tasks table has a due_at column. I seeded the table with 50 values in the future, then in my admin controller I want to grab those tasks to show in the admin panel:
// AdminController.php
$tasks = Task::where('due_at', '>=', 'NOW()')->get();
dd($tasks); // shows zero results
Running the same query in phpmyadmin results in the expected 50 rows:
SELECT * FROM `tasks` WHERE due_at >= now(); // returns 50 rows
If I just reverse the operator, it returns 50 results:
// AdminController.php
$tasks = Task::where('due_at', '<=', 'NOW()')->get();
dd($tasks); // shows 50 results
Am I missing something obvious?
Task::whereRaw('due_at >= NOW()')->get()works?