QuotePdfService, stored on the public disk, and made accessible through a signed storage URL. Admins can also trigger a fresh PDF download at any time.
QuotePdfService
App\Services\QuotePdfService is a thin wrapper around the barryvdh/laravel-dompdf package. It exposes a single generate(array $quoteData): string method that returns the raw PDF binary.
Configuration
| Option | Value |
|---|---|
| Paper size | A4 |
| Orientation | Portrait |
| HTML5 parser | Enabled |
| Remote resources (CSS, images) | Enabled |
| Default font | DejaVu Sans |
| Tax rate injected | 0.16 (16 %) |
Blade template
The service renders the Blade view atresources/views/quotes/pdf/quote.blade.php. The view receives three variables:
| Variable | Description |
|---|---|
$quote | The raw quote data array passed to generate() |
$date | Today’s date formatted as dd/mm/yyyy |
$taxRate | Fixed value 0.16 |
A second Blade view exists at
resources/views/quotes/pdf/cotizacion.blade.php. This view is used directly by the admin reply flow via Pdf::loadView('quotes.pdf.cotizacion', ...) inside QuoteController::generateQuotePdf(), rather than through QuotePdfService.When PDFs are generated
On quote submission (POST /api/quotes/submit)
On quote submission (POST /api/quotes/submit)
When a client submits a quote, The PDF is stored at:The
QuoteController::submit() calls QuotePdfService::generate() with the raw request payload and stores the result:pdf_path column on the Quote record is set to quotes/{reference}.pdf (relative to the public storage disk).On admin reply (POST /admin/cotizaciones/{quote}/reply)
On admin reply (POST /admin/cotizaciones/{quote}/reply)
When an admin schedules a meeting reply, The refreshed PDF is then attached to the
QuoteController::reply() regenerates the PDF from the live Quote model data (not the original request payload) and overwrites the stored file:QuoteReplyMail email sent to the client.On admin download (GET /admin/cotizaciones/{quote}/pdf)
On admin download (GET /admin/cotizaciones/{quote}/pdf)
The admin can download a PDF at any time via This download does not overwrite the stored file.
GET /admin/cotizaciones/{quote}/pdf (named route admin.quotes.pdf). This route calls QuoteController::generatePdf(Request $request, Quote $quote) which:- Rebuilds the data array from the
Quotemodel and itsitemsrelationship. - Instantiates
QuotePdfServiceand callsgenerate(). - Streams the PDF directly as an
application/pdfresponse with the filenamecotizacion-{reference}.pdf.
Accessing stored PDFs
TheQuote model exposes a pdf_url accessor:
Storage path summary
| Context | Disk | Path | Publicly accessible |
|---|---|---|---|
| Quote submission | public | quotes/{reference}.pdf | Yes, via /storage/quotes/{reference}.pdf |
| Admin reply regeneration | public | quotes/{reference}.pdf | Yes (overwrites previous file) |
| Admin download | — | Streamed, not stored | n/a |