|
|
@ -56,6 +56,8 @@ class SeedingImage extends Command
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 'Category':
|
|
|
|
case 'Category':
|
|
|
|
|
|
|
|
$svgs = \File::files(__DIR__ . '/../../../database/seeders/images/svg');
|
|
|
|
|
|
|
|
|
|
|
|
foreach (Category::all() as $item) {
|
|
|
|
foreach (Category::all() as $item) {
|
|
|
|
$this->info('Category: ' . $item->name . ' adding image...');
|
|
|
|
$this->info('Category: ' . $item->name . ' adding image...');
|
|
|
|
shuffle($images);
|
|
|
|
shuffle($images);
|
|
|
@ -75,6 +77,9 @@ class SeedingImage extends Command
|
|
|
|
->optimize()
|
|
|
|
->optimize()
|
|
|
|
->format('webp');
|
|
|
|
->format('webp');
|
|
|
|
$i->save(storage_path() . '/app/public/categories/optimized-'. $item->bg);
|
|
|
|
$i->save(storage_path() . '/app/public/categories/optimized-'. $item->bg);
|
|
|
|
|
|
|
|
shuffle($svgs);
|
|
|
|
|
|
|
|
\File::copy($svgs[0]->getRealPath(),storage_path().'/app/public/categories/' . $svgs[0]->getFilename());
|
|
|
|
|
|
|
|
$item->svg = $svgs[0]->getFilename();
|
|
|
|
$item->save();
|
|
|
|
$item->save();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|