public function getCorrelativeReportNumber() { $ot = OrdenesTrabajoInspeccionEquipo::getLastOtInspeccionEquipo()->first(); $string = ""; if ($ot != null) { $numero = $ot->ot_correlativo; $cantidad_digitos = strlen($numero + 1); for ($i = 0; $i < 4 - $cantidad_digitos; $i++) { $string = $string . "0"; } $string = $string . ($numero + 1); } else { $string = "0001"; } return $string; }