request = $request; $this->id = $id; $this->img = new ImageResize(); } /** * Execute the job. * * @return void */ public function handle() { foreach ($this->request as $screen) { $folder = Carbon::now()->format('Y/m/d'); // 1. Store original (S3 if enabled) $path = $screen->store("uploads/screens/original/{$folder}"); // 2. Local temp for resizing $tempPath = $screen->store('temp', 'public'); $thumb = $this->img->resize($tempPath, 350, 'screens', true); $screens = new Screens(); $screens->name = basename($path); $screens->path = $path; $screens->path_thumb = $thumb; $screens->size = Storage::disk(env('FILESYSTEM_DISK'))->size($path); $screens->product_id = $this->id; $screens->save(); } } }