/** * Get Total by status * * @param $contract_id * @return array */ public function getTotalByStatus($contract_id) { return ['total_completed' => $this->task->completed()->where('contract_id', $contract_id)->count(), 'total_approved' => $this->task->approve()->where('contract_id', $contract_id)->count(), 'total_rejected' => $this->task->rejected()->where('contract_id', $contract_id)->count(), 'total_pending_approval' => $this->task->completed()->approvalPending()->where('contract_id', $contract_id)->count()]; }