function of select data in date range whereBetween
someone can assist me the query to select data range by date.
i want a user input a date., How can i rebuild my query?
public function salesreport()
{
$sales = Sales::select("sales.*")
->whereBetween('created_at', ['2019-09-01', '2019-09-10'])->get();
return view('reports.salesreport');
}
This should do it. Replace from and to with the actual names of the inputs in your form :)
public function salesreport(request $request)
{
$sales = Sales::select("sales.*")
->whereBetween('created_at', [$resquest->input('from'), $request->input('to')])->get();
return view('reports.salesreport'); }
Please or to participate in this conversation.