My task is done but problem with single query.So I want to count data with current date and future date and with status in single query .
My Scopefunctions
public function scopeAction($q){
return $q->wheredueDate(carbon::now()->toDateString())->whereTaskStatus(self::TASK_STATUS_INCOMPLETE);
}
public function scopeSnooze($q){
return $q->where('due_date','>',carbon::now()->toDateString())->whereTaskStatus(self::TASK_STATUS_INCOMPLETE);
}
public function scopeComplete($q){
return $q->whereTaskStatus(self::TASK_STATUS_COMPLETE);
}
And my query
$countByStatus['actionTotal'] = Tasks::active()->action()->count();
$countByStatus['snoozeTotal'] = Tasks::active()->snooze()->count();
$countByStatus['completeTotal'] = Tasks::active()->complete()->count();
$result = DB::select("SELECT (SELECT count(*) FROM task WHERE staus = 'active' active_tasks), (SELECT count(*) FROM tasks WHERE status = 'sleeping') sleeping_tasks, SELECT count(*) FROM tasks WHERE status = 'completed'") ;