public static function AtualizaAluguel() { $teste = "-"; $contratos = models\Contrato::getAtivos(); foreach ($contratos as $item) { $contrato = models\Contrato::findOne($item->id); if (\app\models\Despesa::verificaAluguel($contrato->id)) { $despesa = \app\models\Despesa::verificaAluguel($contrato->id); if (Setup::VerificaDia($despesa->data)) { $aluguel = models\Despesa::LancaAluguel(Setup::VerificaDia($despesa->data), $contrato->id); } } else { if (Setup::VerificaDia($contrato->data_inicio)) { $aluguel = models\Despesa::LancaAluguel($contrato->data_inicio, $contrato->id); } } } }
/** * Finds the Contrato model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Contrato the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Contrato::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }