entities as $entity) { $this->LogMessage("V5_DB1"); $count_db_1 = $entity::on('db-ninja-01')->count(); $count_db_2 = $entity::on('db-ninja-02a')->count(); $diff = $count_db_1 - $count_db_2; if($diff != 0) $this->logMessage("{$entity} DB1: {$count_db_1} - DB2: {$count_db_2} - diff = {$diff}"); } foreach($this->entities as $entity) { $this->LogMessage("V5_DB2"); $count_db_1 = $entity::on('db-ninja-02')->count(); $count_db_2 = $entity::on('db-ninja-01a')->count(); $diff = $count_db_1 - $count_db_2; if($diff != 0) $this->logMessage("{$entity} DB1: {$count_db_1} - DB2: {$count_db_2} - diff = {$diff}"); } } private function logMessage($str) { $str = date('Y-m-d h:i:s').' '.$str; $this->info($str); $this->log .= $str."\n"; } }