I am using laravel 8 and I want to get ids between two dates form created_at column which is timestamp format I use the following code
$ids=Visit::select('id')->whereBetween('created_at',[$request->input('from_date'),$request->input('to_date')])->get();
return response($ids);
but I get an empty result
I tired to convert the inputs to time using the strtotime() function but also I get the same empty result
$ids=Visit::select('id')->whereBetween('created_at',[strtotime($request->input('from_date')),strtotime($request->input('to_date'))])->get();
return response($ids);
the input type in view page is date
could you please help with the correct syntax
Aucun commentaire:
Enregistrer un commentaire