Merge pull request 'Added validation part for generate pdf' (#39) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #39
This commit was merged in pull request #39.
This commit is contained in:
2025-12-22 12:19:39 +00:00

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());
}