Exemple #1
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     if ($this->user->is_queued) {
         $time_start = microtime(true) . "s\n";
         echo 'Preparing user: '******'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 3) {
             $this->user->is_queued = 3;
             $this->user->save();
             echo "Notifications\n";
             NotificationsSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 4) {
             $this->user->is_queued = 4;
             $this->user->save();
             echo "PastoralCare\n";
             PastoralCareSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 5) {
             $this->user->is_queued = 5;
             $this->user->save();
             echo "SportsZone\n";
             SportsZoneSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         if ($this->user->is_queued <= 6) {
             $this->user->is_queued = 6;
             $this->user->save();
             echo "Timetable\n";
             TimetableSource::update($this->user);
         }
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
         $this->user->is_queued = 0;
         $this->user->save();
         $time_end = microtime(true);
         echo 'Time: ' . ($time_end - $time_start) . "s\n";
     }
     $this->user->save();
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->log_wake();
     $errors = 0;
     foreach (User::all() as $index => $user) {
         $this->log_section('User ' . $user->user_id);
         try {
             TimetableSource::update($user);
             $this->log_section_end('Completed successfully.');
         } catch (\Exception $e) {
             $errors++;
             $this->comment('Exception');
             $this->error($e);
             $this->log_section_end('Failed.', true);
         }
     }
     $this->info("Completed with {$errors} errors.");
     if ($errors != 0) {
         $this->dispatch("Timetable");
     }
 }