Added validation part for generate pdf
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Successful in 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Laravel Pint / pint (pull_request) Failing after 2m29s
Laravel Larastan / larastan (pull_request) Failing after 2m33s

This commit is contained in:
dhanabalan
2025-12-22 17:49:25 +05:30
parent 9913df30c6
commit 2055a768ef

View File

@@ -9,6 +9,7 @@ use App\Models\ProcessOrder;
use App\Models\StickerStructureDetail;
use App\Models\User;
use App\Services\StickerPdfService;
use Filament\Notifications\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Response;
@@ -895,9 +896,21 @@ class PdfController extends Controller
public function generate(string $stickerId)
{
$stickerId = trim($stickerId);
$elements = StickerStructureDetail::where('sticker_id', $stickerId)
->first();
if (!$elements) {
Notification::make()
->title('Sticker not found')
->body("Sticker ID '{$stickerId}' does not exist.")
->danger()
->send();
return;
}
$pdfService = new StickerPdfService();
return $pdfService->generate($stickerId, $elements->toArray());
}