info('RUN Command user:restore'); $this->timeStart = microtime(true); $this->restoreInavtiveUsers(); return 0; //\Log::info('Cron is running'); //return 0; } //gibt es gelöschte Berater mit Kunden und childs??? private function restoreInavtiveUsers(){ $this->info('START Command restoreInavtiveUsers'); $count = 0; $this->user_id = $this->argument('user_id'); if(!$this->user_id){ $this->info('NO user_id as argument'); return; } $this->info('RUN Command restoreInavtiveUsers on user_id: '.$this->user_id); $user = User::find($this->user_id); if(!$user){ $this->info('restoreInavtiveUsers find no user by user_id:'.$this->user_id); \Log::channel('cleanup')->error('restoreInavtiveUsers find no user by user_id:'.$this->user_id); return 0; } $data = [ 'user_id' => $user->id, 'email' => $user->email, 'm_account' => $user->account ? $user->account->m_account : '', 'm_first_name' => $user->account ? $user->account->m_first_name : '', 'm_last_name' => $user->account ? $user->account->m_last_name : '', ]; \Log::channel('cleanup')->info('reactiveUser: '.json_encode($data)); UserUtil::reactiveUser($user); //childs wieder herstellen UserUtil::resetChildsToSponsor($user->id); $diff = microtime(true) - $this->timeStart; $sec = intval($diff); $micro = $diff - $sec; $this->info('END Command deleteInavtiveUsers: '.$count. ' | Time: '.$sec. 'sec :' . round($micro * 1000, 4) . " ms"); } } //497 //489 -> de //478 new