27 lines
662 B
PHP
27 lines
662 B
PHP
<?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();
|
|
}
|
|
}
|
|
}
|