fileOf($job, $task, $image, $size === 'thumbnail') ?? abort(404); $disk = Storage::disk('local'); abort_unless($disk->exists($file->path), 404); $headers = ['Content-Type' => 'image/jpeg', 'Cache-Control' => 'private, max-age=86400']; return $request->boolean('download') ? $disk->download($file->path, $file->downloadName, $headers) : $disk->response($file->path, $file->downloadName, $headers); } }