getCurrentEvents() as $costUnit) { $billingEndTime = \DateTime::createFromFormat('Y-m-d H:i:s', $costUnit['billing_deadline']); $billingEndTime->setTime(0,0,0); $billingEndTime->add(new \DateInterval('P1D')); $now = now(); if ($billingEndTime < $now) { new ChangeCostUnitStateCommand( new ChangeCostUnitStateRequest( CostUnit::where('id', $costUnit['id'])->first(),false, false ) )->execute(); } } } }