WIP
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Importers\Image\Jobs\FinishImageModification;
|
||||
use App\Models\Album;
|
||||
use App\Models\Image;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
@@ -23,11 +24,6 @@ class ImageFactory extends Factory
|
||||
public function configure(): static
|
||||
{
|
||||
return $this->afterCreating(function (Image $image) {
|
||||
if($image->album->images->sortBy('id')->first()->id == $image->id) {
|
||||
$image->isCover = true;
|
||||
$image->save();
|
||||
}
|
||||
|
||||
$height = rand(2000, 4000);
|
||||
$width = rand(2000, 4000);
|
||||
$image_content = Http::get("https://picsum.photos/{$width}/{$height}")->body();
|
||||
@@ -35,10 +31,13 @@ class ImageFactory extends Factory
|
||||
$image_path = $image->album_id . '/original/' . $image->id . '.avif';
|
||||
Storage::disk('images')->put($image_path, $encoded);
|
||||
|
||||
Bus::batch([
|
||||
new GenerateThumbnail($image),
|
||||
new GenerateFullscreen($image),
|
||||
])->name('seeder_import_batch_' . $image->id)->dispatch();
|
||||
Bus::chain([
|
||||
Bus::batch([
|
||||
new GenerateThumbnail($image),
|
||||
new GenerateFullscreen($image),
|
||||
]),
|
||||
new FinishImageModification($image),
|
||||
])->dispatch();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user