I've been spinning my wheels on this for hours. Here's the deal. This works fine:
$logs = ViewLog::where('created_at', '>=', $start)
->where('created_at', '<=', $end)
->get();
And this also works fine:
$logs = ViewLog::where('item_id', $id)->get();
But, even though there are records that match this query, it returns an empty collection:
$logs = ViewLog::where('created_at', '>=', $start)
->where('created_at', '<=', $end)
->where('item_id', $id)
->get();
What's more infuriating is that the exact query that always comes back empty in my code, works flawlessly when using tinker
. Has anyone ever run into a similar issue?
Updated to answer Maantje's question in the comments
Output of dd(DB::getQueryLog());
:
array:1 [▼
0 => array:3 [▼
"query" => "select * from `view_logs` where `created_at` >= ? and `created_at` <= ? and `object3d_id` = ?"
"bindings" => array:3 [▼
0 => "2016-05-01 00:00:00"
1 => "2016-05-31 23:59:59"
2 => 24
]
"time" => 0.77
]
]
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire