From 8de99876e8e7f65af6ca8a6d35716966d22ba74d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 26 May 2018 16:44:44 -0600 Subject: [PATCH] Add CatchUnoptimizedMedia cronjob command --- .../Commands/CatchUnoptimizedMedia.php | 47 +++++++++++++++++++ app/Console/Kernel.php | 4 +- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 app/Console/Commands/CatchUnoptimizedMedia.php diff --git a/app/Console/Commands/CatchUnoptimizedMedia.php b/app/Console/Commands/CatchUnoptimizedMedia.php new file mode 100644 index 00000000..01b8f79c --- /dev/null +++ b/app/Console/Commands/CatchUnoptimizedMedia.php @@ -0,0 +1,47 @@ +take(50)->get(); + foreach($medias as $media) { + ImageOptimize::dispatch($media); + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a8c51585..bb5923aa 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -24,8 +24,8 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - // $schedule->command('inspire') - // ->hourly(); + $schedule->command('media:optimize') + ->hourly(); } /**