From 198d817d288cc2e6c018d2b4e79c5b1f53681d57 Mon Sep 17 00:00:00 2001 From: Johannes Pichler Date: Mon, 8 Oct 2018 06:37:47 +0200 Subject: [PATCH 1/2] Add information about environments method This will add information about the `environments` method that allows to limit execution of a scheduled task to a specific environmentf --- scheduling.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scheduling.md b/scheduling.md index b50c562d253..c6461ab2402 100644 --- a/scheduling.md +++ b/scheduling.md @@ -182,6 +182,14 @@ The `skip` method may be seen as the inverse of `when`. If the `skip` method ret When using chained `when` methods, the scheduled command will only execute if all `when` conditions return `true`. +#### Environment Constraints + +The `environments` method may be used to execute tasks only on certain environments. Only if the current environment matches the given environment or the list of environments the task will be executed. + + $schedule->command('emails:send') + ->daily() + ->environments(['staging', 'production']); + ### Timezones From c10bed130485c0261a62f90bed8b1ce584fb390d Mon Sep 17 00:00:00 2001 From: Johannes Pichler Date: Mon, 8 Oct 2018 08:09:10 +0200 Subject: [PATCH 2/2] Add environments method also to table --- scheduling.md | 1 + 1 file changed, 1 insertion(+) diff --git a/scheduling.md b/scheduling.md index c6461ab2402..ddbf5fb0dda 100644 --- a/scheduling.md +++ b/scheduling.md @@ -151,6 +151,7 @@ Method | Description `->saturdays();` | Limit the task to Saturday `->between($start, $end);` | Limit the task to run between start and end times `->when(Closure);` | Limit the task based on a truth test +`->environments($env);` | Limit the task to be only executed on a certain environment #### Between Time Constraints