File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
src/Illuminate/Foundation/Configuration Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 3
3
namespace Illuminate \Foundation \Configuration ;
4
4
5
5
use Closure ;
6
+ use Illuminate \Console \Application as Artisan ;
7
+ use Illuminate \Console \Scheduling \Schedule ;
6
8
use Illuminate \Contracts \Console \Kernel as ConsoleKernel ;
7
9
use Illuminate \Contracts \Http \Kernel as HttpKernel ;
8
10
use Illuminate \Foundation \Application ;
@@ -280,6 +282,21 @@ protected function withCommandRouting(array $paths)
280
282
});
281
283
}
282
284
285
+ /**
286
+ * Register the scheduled tasks for the application.
287
+ *
288
+ * @param callable(Schedule $schedule): void $callback
289
+ * @return $this
290
+ */
291
+ public function withSchedule (callable $ callback )
292
+ {
293
+ $ this ->app ->afterResolving (ConsoleKernel::class, function (ConsoleKernel $ kernel ) use ($ callback ) {
294
+ Artisan::starting (fn () => $ callback ($ this ->app ->make (Schedule::class)));
295
+ });
296
+
297
+ return $ this ;
298
+ }
299
+
283
300
/**
284
301
* Register and configure the application's exception handler.
285
302
*
You can’t perform that action at this time.
0 commit comments