Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e34ca79

Browse files
committedNov 19, 2024
added svg support to image seeder
1 parent fbd2c43 commit e34ca79

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎app/Console/Commands/SeedingImage.php

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public function handle()
5656
}
5757
break;
5858
case 'Category':
59+
$svgs = \File::files(__DIR__ . '/../../../database/seeders/images/svg');
60+
5961
foreach (Category::all() as $item) {
6062
$this->info('Category: ' . $item->name . ' adding image...');
6163
shuffle($images);
@@ -75,6 +77,9 @@ public function handle()
7577
->optimize()
7678
->format('webp');
7779
$i->save(storage_path() . '/app/public/categories/optimized-'. $item->bg);
80+
shuffle($svgs);
81+
\File::copy($svgs[0]->getRealPath(),storage_path().'/app/public/categories/' . $svgs[0]->getFilename());
82+
$item->svg = $svgs[0]->getFilename();
7883
$item->save();
7984
}
8085
break;

0 commit comments

Comments
 (0)
Please sign in to comment.