Files
Nexora/app/Jobs/ProcessDocumentUpload.php

27 lines
662 B
PHP
Raw Normal View History

2025-04-23 00:14:33 +06:00
<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class ProcessDocumentUpload implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function __construct(public Document $document, public UploadedFile $file)
{
}
public function handle()
{
// Lógica para procesar el archivo
$this->document->createVersion($this->file);
// Generar miniaturas si es imagen
if (Str::startsWith($this->file->getMimeType(), 'image/')) {
$this->document->generateThumbnails();
}
}
}