/** * Count total Contracts * * @param string $date * @return contract */ public function countContractTotal($date = '') { switch ($date) { case 'today': $dateFormat = $this->carbon->today()->toDateString(); break; case 'yesterday': $dateFormat = $this->carbon->yesterday()->toDateString(); break; case 'this_month': $dateFormat = [$this->carbon->firstOfMonth()->toDateString(), $this->carbon->now()->toDateString()]; break; case 'last_month': $dateFormat = [$this->carbon->now()->subMonth(1)->firstOfMonth()->toDateString(), $this->carbon->now()->subMonth(1)->endOfMonth()->toDateString()]; break; default: $dateFormat = ''; break; } return $this->contract->countTotal($dateFormat); }