Skip to content

Commit

Permalink
Remove media handling from database seeder
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubz committed Apr 8, 2021
1 parent a1d12cd commit 264a194
Show file tree
Hide file tree
Showing 26 changed files with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions database/Seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
use App\Support\Nutrients;
use Illuminate\Database\Seeder;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;

class DatabaseSeeder extends Seeder
Expand Down Expand Up @@ -46,8 +44,6 @@ public function run(): void
->count(25)
->create();

$storage = Storage::disk('seeder');
$photos = new Collection($storage->files('photos'));
/** @var \App\Models\Recipe $recipe */
foreach ($recipes as $recipe) {
$ingredients = [];
Expand All @@ -60,12 +56,6 @@ public function run(): void
]);
}
$recipe->ingredientAmounts()->saveMany($ingredients);

$recipe->addMediaFromStream($storage->get($photos->pop()))
->usingName($recipe->name)
->usingFileName("{$recipe->slug}.jpg")
->preservingOriginal()
->toMediaCollection();
}

for ($i = 0; $i <= 31; $i++) {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed storage/seeder/photos/cala-w6ftFbPCs9I-unsplash.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed storage/seeder/photos/emy-XoByiBymX20-unsplash.jpg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 264a194

Please sign in to comment.