This seems like an easy one but maybe I am looking at the problem too simplistically. All I want to do is produce the count of 'delivery_date' days which have a 'delivery_date' greater than today. The $allDeliveries just produces a 0. If I addDays to today then I will get the delivery count for that day. So it is reading the data so my query is the problem.
public function show()
{
$ID = auth()->user()->id;
$date = Carbon::today()->toDateString();
$today = Carbon::today();
$userorders = DB::table('order_headers')->where('user_id', $ID);
$ordercount = $userorders->where('status', 'active')->count();
$usertickets = DB::table('ticketit')->where('user_id', $ID);
$ticketcount = $usertickets->where('status_id', '1')->count();
$today->modify('+5 days');
$modified_date = $today->format('Y-m-d');
$userorderstoday = DB::table('order_headers')->where('user_id', $ID);
$deliveriesToday = $userorderstoday->where('delivery_date', '=', $today)->count();
$allDeliveries = $userorderstoday->where('delivery_date', '>', $today)->count();
return view('home', ['date' =>$date, 'ordercount' => $ordercount, 'allDeliveries' => $allDeliveries, 'modified_date' =>$modified_date, 'ticketcount' => $ticketcount, 'deliveriesToday' => $deliveriesToday]);
}
You can ignore the $modified_date as I am just temporarily using to show output in my view,
Thanks in advance - Noob...