Explorar o código

自动后台任务

visuddhinanda@gmail.com %!s(int64=4) %!d(string=hai) anos
pai
achega
d990b72a2a
Modificáronse 1 ficheiros con 10 adicións e 0 borrados
  1. 10 0
      app/Console/Kernel.php

+ 10 - 0
app/Console/Kernel.php

@@ -16,6 +16,16 @@ class Kernel extends ConsoleKernel
     protected function schedule(Schedule $schedule)
     protected function schedule(Schedule $schedule)
     {
     {
         // $schedule->command('inspire')->hourly();
         // $schedule->command('inspire')->hourly();
+        $schedule->timezone('Asia/Shanghai')
+                 ->command('upgrade:daily')
+                 ->dailyAt('00:00')
+                 ->onSuccess(function () {
+                    // The task succeeded...
+                    
+                  })
+                 ->onFailure(function () {
+                    // The task failed...
+                 });
     }
     }
 
 
     /**
     /**