Guys iam making small correction in my project milkfarm
whats my doubt is
i have three records in my db
consider this. this is my table structure.
17-01-2019 am Abdul 30 litres
17-01-2019 pm Abdul 50 litres.
17-01-2019 pm Abdul 90 litres.
see in the above example Abdul had bought milk on 17-01-2019 am=30 litres and 17-01-2019 pm 50+90=140 litres
Now how i need to fetch my record and display like below format,
Customer 17-01-2019 litres
Name am pm total
Abdul 30 140 80
The date must display once but time must display am and pm. but if am or pm the milk bought two times means it must be added and displayed. how to do this.
consider that these are my columns in my sales_details table
date
time
customer_name
litres
and this my model
Sales_details
if i give like this
$sales=Sales_details::orderBy('created_at','desc')->get();
just it fetches all and displays like this
17-01-2019 am Abdul 30 litres
17-01-2019 pm Abdul 50 litres.
17-01-2019 pm Abdul 90 litres.
but i expect like this
Customer 17-01-2019 litres
Name am pm total
Abdul 30 140 80
Kindly help please
i couldnt get the idea please