diff --git a/src/Illuminate/Console/Scheduling/Event.php b/src/Illuminate/Console/Scheduling/Event.php index 41d55954c101..1ee8d2ed700d 100644 --- a/src/Illuminate/Console/Scheduling/Event.php +++ b/src/Illuminate/Console/Scheduling/Event.php @@ -8,11 +8,13 @@ use GuzzleHttp\Client as HttpClient; use Illuminate\Contracts\Mail\Mailer; use Symfony\Component\Process\Process; +use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Cache\Repository as Cache; class Event { + use Macroable; use ManagesFrequencies; /** diff --git a/tests/Console/Scheduling/FrequencyTest.php b/tests/Console/Scheduling/FrequencyTest.php index 4096f65cdf82..edfb77264425 100644 --- a/tests/Console/Scheduling/FrequencyTest.php +++ b/tests/Console/Scheduling/FrequencyTest.php @@ -104,4 +104,13 @@ public function testSaturdays() { $this->assertEquals('* * * * 6 *', $this->event->saturdays()->getExpression()); } + + public function testFrequencyMacro() + { + Event::macro('everyXMinutes', function ($x) { + return $this->spliceIntoPosition(1, "*/{$x}"); + }); + + $this->assertEquals('*/6 * * * * *', $this->event->everyXMinutes(6)->getExpression()); + } }