With Laravel And MongoDB not working date range
jaymeen1 opened this issue · 2 comments
jaymeen1 commented
Model Code
class SalesOrder extends BaseModel
{
use DateScopes;
protected $collection = 'sales_orders';
}
Model Usage
public function getSalesOrderFilterWise(Request $request): JsonResponse
{
$response = SalesOrder::ofLastMonths();
//->get();
return jsonData([
'message' => 'Data Found',
'data' => $response,
]);
}
Given Response
{
"message": "Data Found",
"data": {}
}
With the below code it gives me a data
$range = [
now()->subWeeks(2),
now(),
];
$response = SalesOrder::whereBetween('created_at', $range)
->get();
I already created last month sales orders and using this trait i'm not be able to found any data if you have any suggestion or my mistake please correct me.
Sairahcaz commented
@jaymeen1 unfortunately I do not have the time now to debug this issue. But feel free to temporary edit the venodr files and debug it by yourself. If you find a fix please send a PR!
jaymeen1 commented
@Sairahcaz sure i'll try to fix that issue and send a PR.