Flush cache before resize:make artisan command

This commit is contained in:
Philipp Lang 2021-09-06 17:47:46 +02:00
parent 4ca17d1065
commit ca9b03f36a
2 changed files with 8 additions and 1 deletions

View File

@ -40,4 +40,9 @@ class CacheManager
return "resizer.{$size}.{$normalPath}";
}
public function flush(): void
{
Cache::tags('resizer')->flush();
}
}

View File

@ -1,5 +1,6 @@
<?php namespace Aweos\Resizer\Console;
use Aweos\Resizer\Classes\CacheManager;
use Aweos\Resizer\Classes\ResizeJob;
use Aweos\Resizer\Models\Setting;
use GuzzleHttp\Client;
@ -42,11 +43,12 @@ class ResizeMake extends Command
* Execute the console command.
* @return void
*/
public function handle()
public function handle(CacheManager $cacheManager)
{
$this->media = MediaLibrary::instance();
ProgressBar::setFormatDefinition('custom', '%current%/%max% %bar% -- %message% (%size%)');
Storage::deleteDirectory('uploads/public/c');
$cacheManager->flush();
foreach (Setting::get('folders') as $folder) {
$this->resize($folder['folder']);