first commit
This commit is contained in:
26
app/Jobs/ProcessDocumentUpload.php
Normal file
26
app/Jobs/ProcessDocumentUpload.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user