Files
dreamstudio/app/Jobs/GenerateVideoJob.php
T
root 79320950e7 Initial commit: Runware-powered content generator foundation
Laravel app with a cost-tracked Runware.ai integration (image, video,
text generation), a hard monthly EUR budget cap with live USD/EUR FX
conversion, and a locally-maintained model/pricing table since
Runware's model-search API doesn't expose pricing.
2026-09-23 15:59:05 +03:00

35 lines
934 B
PHP

<?php
namespace App\Jobs;
use App\Models\Generation;
use App\Services\Runware\GenerationService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Throwable;
class GenerateVideoJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
// Video submission + polling can legitimately take minutes.
public int $timeout = 900;
public int $tries = 1;
public function __construct(public Generation $generation) {}
public function handle(GenerationService $generations): void
{
try {
$generations->processVideo($this->generation);
} catch (Throwable $e) {
$this->generation->update(['status' => 'failed', 'error' => $e->getMessage()]);
throw $e;
}
}
}