i have a route admin confirm blade where i am directly returning red and green distance but in record i have date filter from(start) and to(end) but i want when i apply date fiter it should also apply to from and to (red and green distance) but i dont know how to apply i am interny here is code
red and green
$redTotalDistance = Order::where('ot_customer_distance', '>', 0.3)->whereNotNull('is_confirmed_admin')->pluck('id')->count();
$redTodayDistance = Order::where('ot_customer_distance', '>', 0.3)->whereNotNull('is_confirmed_admin')->whereDate('created_at', date('Y-m-d'))->pluck('id')->count();
$greenTotalDistance = Order::where('ot_customer_distance', '<', 0.3)->whereNotNull('is_confirmed_admin')->pluck('id')->count();
$greenTodayDistance = Order::where('ot_customer_distance', '<', 0.3)->whereNotNull('is_confirmed_admin')->whereDate('created_at', date('Y-m-d'))->pluck('id')->count();
$distance_data['red_total_distance'] = $redTotalDistance;
$distance_data['red_today_distance'] = $redTodayDistance;
$distance_data['green_total_distance'] = $greenTotalDistance;
$distance_data['green_today_distance'] = $greenTodayDistance;
for all admin confirm order
public function getAdminConfirmedOrders(Request $request){
if($request->from){
$dates=$this->dateFilter($request->from,$request->to);
$from=$dates[0];
$to=$dates[1];
}
$id=Auth::id();
if(Auth::user()->role == 1){
if($from == ""){
$orders = Order::has('get_ot_creater')
->where('is_confirmed_admin',"!=",NULL)
->get();
}
else {
$orders = Order::has('get_ot_creater')
->where('is_confirmed_admin',"!=",NULL)
->whereBetween('created_at', array($from, $to))
->get();
}
}
return $this->index($orders,4);
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire