You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Products]: Upload one or more Product Images for invoice/quote display #388
changed the title [-][Feature request] Product Images[/-][+][Feature request] bring able to upload ine or more Product Images and attach it to quotes[/+]on Feb 9, 2023
changed the title [-][Feature request] bring able to upload ine or more Product Images and attach it to quotes[/-][+][Feature request] bring able to upload ine or more Product Images and attach it to quotes and invoices[/+]on Feb 9, 2023
changed the title [-][Feature request] bring able to upload ine or more Product Images and attach it to quotes and invoices[/-][+][Feature request] being able to upload ine or more Product Images and attach it to quotes and invoices[/+]on Feb 9, 2023
changed the title [-][Feature request] being able to upload ine or more Product Images and attach it to quotes and invoices[/-][+][Feature request] being able to upload one or more Product Images and attach it to quotes and invoices[/+]on Feb 9, 2023
Add the ability to upload one or more images when creating/editing a product, and display those images in both Quote and Invoice PDF templates so clients can see visual representations of products being quoted or invoiced.
Observations
The application uses a modular Laravel architecture with Filament for admin interfaces. Products are managed in Modules/Products/ with a model, Filament resource, and schema-based forms. Products link to Quotes and Invoices through line item tables (quote_items, invoice_items) with product_id foreign keys. File uploads use Filament's FileUpload component with local storage at storage/app/private. PDF generation uses DomPDF/wkhtmltopdf with Blade templates in custom/templates/ directories, falling back to default templates. The Quote and Invoice PDF templates iterate through line items to render product details.
AssumptionsAssumption 1: Single Image vs Multiple Images
Options Considered:
Single image field (image string) - Simpler but less flexible
Multiple images field (images JSON array) - More flexible, matches title requirement
Chosen Option: 2
Rationale: Implement multiple image support using a JSON array field, as the title explicitly requests "one or more" images and Filament's FileUpload component handles this natively with ->multiple().
Assumption 2: Image Storage Approach
Options Considered:
JSON array field on products table - Simple, no additional tables
Separate product_images table - More normalized, adds complexity
Spatie Media Library - Feature-rich but adds dependency
Chosen Option: 1
Rationale: Use a JSON array field (images) on the products table. This follows the existing pattern used by Filament FileUpload for multiple files, requires no additional dependencies, and keeps the implementation straightforward.
💡 User Tips
Regenerate the plan with different choices with @coderabbitai <feedback>.
Implementation Steps
Phase 1: Product Image Storage and Upload
This phase adds the infrastructure for storing and uploading product images, including database schema changes, model updates, and the Filament form component.
Task 1: Add Database Migration for Product Images
Add a migration to store product images in the products table.
Create new migration in Modules/Products/Database/Migrations/ to add images column
Use JSON/text column type to store array of image paths
Column should be nullable since existing products won't have images
Task 2: Update Product Model
Extend the Product model to handle the new images field.
Update Modules/Products/Models/Product.php to add images to the $fillable array
Add cast for images field to array type so JSON is automatically serialized/deserialized
Add a helper method or accessor to retrieve full storage URLs for images if needed for template rendering
Task 3: Add Image Upload to Product Form
Add the FileUpload component to the product creation/edit form.
Add FileUpload::make('images') component following existing patterns from Settings.php logo upload
Configure with ->multiple(), ->image(), ->directory('products'), ->maxSize(2048), ->reorderable()
Enable image preview with ->previewable() and ->imagePreviewHeight('100')
Add appropriate label using translation key (add to language files if needed)
Position the field appropriately within the existing form layout
🤖 Prompt for AI agents
Add database support and UI for uploading multiple product images. The goal is
to enable users to attach one or more images to products through the admin
interface.
- Create migration to add nullable `images` JSON column to products table
- Update Product model: add `images` to fillable, cast to array, add helper
method for full storage URLs
- Add FileUpload component to ProductForm.php with multiple image support,
preview, reordering, directory set to 'products', and max size 2048
Phase 2: Display Product Images in PDF Templates
This phase updates the Quote and Invoice PDF templates to render product images within line items, providing visual context for clients.
Task 1: Update Quote PDF Template
Modify the Quote PDF template to display product images alongside line items.
Apply the same image display pattern implemented for Quote templates
Within the line items loop (@foreach ($invoice->items as $item)), add conditional image display
Maintain consistent styling and sizing with the Quote template
Ensure the product relationship is available (may need eager loading in Modules/Core/Support/HTML.php invoice method)
Task 3: Ensure Product Relationship is Loaded for PDF Rendering
Verify and update PDF rendering services to eager load product relationships with images.
Review Modules/Core/Support/HTML.php methods for quote and invoice rendering
Ensure items relationship eager loads the product: ->with('items.product')
This ensures product images are available without N+1 queries when rendering PDFs
Check both quote() and invoice() methods in the HTML support class
🤖 Prompt for AI agents
Display product images in Quote and Invoice PDF templates. The goal is to render
product images within line items so clients see visual representations of
products.
- Update Quote PDF template: add conditional image display in line items loop,
check for product and images, show thumbnails (first image or gallery), maintain
layout and backwards compatibility
- Update Invoice PDF template: apply same image display pattern as Quote
template with consistent styling
- Update HTML.php PDF rendering methods: eager load product relationship with
`->with('items.product')` to avoid N+1 queries
🚀 Next Steps
🤖 All AI agent prompts combined
Task: 1
Add database support and UI for uploading multiple product images. The goal is
to enable users to attach one or more images to products through the admin
interface.
- Create migration to add nullable `images` JSON column to products table
- Update Product model: add `images` to fillable, cast to array, add helper
method for full storage URLs
- Add FileUpload component to ProductForm.php with multiple image support,
preview, reordering, directory set to 'products', and max size 2048
===============================================================================
Task: 2
Display product images in Quote and Invoice PDF templates. The goal is to render
product images within line items so clients see visual representations of
products.
- Update Quote PDF template: add conditional image display in line items loop,
check for product and images, show thumbnails (first image or gallery), maintain
layout and backwards compatibility
- Update Invoice PDF template: apply same image display pattern as Quote
template with consistent styling
- Update HTML.php PDF rendering methods: eager load product relationship with
`->with('items.product')` to avoid N+1 queries
💡 Iterate on the plan with:
@coderabbitai <feedback>
Example Feedback
- `@coderabbitai` You can skip phase 3. Add a simple unit test case for phase 2.
- `@coderabbitai` For assumption 1 go ahead with option 3 and replan.
💬 Have feedback or questions? Drop into our discord!
Story: As a company admin, I want to upload a product image when creating or editing a product, so that the image appears on quotes and invoices to help clients identify exactly what they are purchasing.
v2 context: The Product model is in Modules/Products/. v2 has an Upload model in Core. The product image should be stored via UploadService and the image URL made available to the invoice/quote PDF blade template.
Acceptance Criteria:
Product create/edit form has an Image file upload field (accepted types: JPEG, PNG, WebP; max 2 MB).
The uploaded image is stored in storage/company/{company_id}/products/ and linked via an Upload polymorphic record.
The product image URL is available as $product->image_url (accessor).
On invoice/quote PDF templates, if a product has an image, it is rendered as a thumbnail (<img>) in the line item row.
Image display on the PDF is optional (configurable via a "Show product images on PDF" setting).
If no image is uploaded, no broken image placeholder appears.
Implementation:
Add FileUpload::make('image') to Modules/Products/Filament/Company/Resources/Products/Schemas/ProductSchema.php.
Product::getImageUrlAttribute(): look up $this->uploads()->first()?->file_path and return Storage::url($path).
In the invoice PDF blade: @if($item->product?->image_url && $settings->show_product_images) ``<img src="{{ $item->product->image_url }}" ...>`` @endif.
changed the title [-][Feature request] being able to upload one or more Product Images and attach it to quotes and invoices[/-][+][Products]: Upload one or more Product Images for invoice/quote display[/+]on Jun 13, 2026
Activity
[-][Feature request] Product Images[/-][+][Feature request] bring able to upload ine or more Product Images and attach it to quotes[/+][-][Feature request] bring able to upload ine or more Product Images and attach it to quotes[/-][+][Feature request] bring able to upload ine or more Product Images and attach it to quotes and invoices[/+][-][Feature request] bring able to upload ine or more Product Images and attach it to quotes and invoices[/-][+][Feature request] being able to upload ine or more Product Images and attach it to quotes and invoices[/+][-][Feature request] being able to upload ine or more Product Images and attach it to quotes and invoices[/-][+][Feature request] being able to upload one or more Product Images and attach it to quotes and invoices[/+]nielsdrost7 commentedon Feb 9, 2023
Great job with the Feature Request.
This would be a candidate for a new feature in v2
nielsdrost7 commentedon Jan 19, 2026
@coderabbitai plan
coderabbitai commentedon Jan 19, 2026
Coding Plan
Approach
Add the ability to upload one or more images when creating/editing a product, and display those images in both Quote and Invoice PDF templates so clients can see visual representations of products being quoted or invoiced.
Observations
The application uses a modular Laravel architecture with Filament for admin interfaces. Products are managed in
Modules/Products/with a model, Filament resource, and schema-based forms. Products link to Quotes and Invoices through line item tables (quote_items,invoice_items) withproduct_idforeign keys. File uploads use Filament'sFileUploadcomponent with local storage atstorage/app/private. PDF generation uses DomPDF/wkhtmltopdf with Blade templates incustom/templates/directories, falling back to default templates. The Quote and Invoice PDF templates iterate through line items to render product details.Assumptions
Assumption 1: Single Image vs Multiple Images
Options Considered:
imagestring) - Simpler but less flexibleimagesJSON array) - More flexible, matches title requirementChosen Option: 2
Rationale: Implement multiple image support using a JSON array field, as the title explicitly requests "one or more" images and Filament's FileUpload component handles this natively with
->multiple().Assumption 2: Image Storage Approach
Options Considered:
product_imagestable - More normalized, adds complexityChosen Option: 1
Rationale: Use a JSON array field (
images) on the products table. This follows the existing pattern used by Filament FileUpload for multiple files, requires no additional dependencies, and keeps the implementation straightforward.💡 User Tips
Regenerate the plan with different choices with
@coderabbitai <feedback>.Implementation Steps
Phase 1: Product Image Storage and Upload
This phase adds the infrastructure for storing and uploading product images, including database schema changes, model updates, and the Filament form component.
Task 1: Add Database Migration for Product Images
Add a migration to store product images in the products table.
Modules/Products/Database/Migrations/to addimagescolumnTask 2: Update Product Model
Extend the Product model to handle the new images field.
Modules/Products/Models/Product.phpto addimagesto the$fillablearrayimagesfield toarraytype so JSON is automatically serialized/deserializedTask 3: Add Image Upload to Product Form
Add the FileUpload component to the product creation/edit form.
Modules/Products/Filament/Company/Resources/Products/Schemas/ProductForm.phpFileUpload::make('images')component following existing patterns from Settings.php logo upload->multiple(),->image(),->directory('products'),->maxSize(2048),->reorderable()->previewable()and->imagePreviewHeight('100')🤖 Prompt for AI agents
Phase 2: Display Product Images in PDF Templates
This phase updates the Quote and Invoice PDF templates to render product images within line items, providing visual context for clients.
Task 1: Update Quote PDF Template
Modify the Quote PDF template to display product images alongside line items.
custom/templates/quote_templates/custom.blade.php@foreach ($quote->items as $item)), add conditional image display$item->productexists and has images before attempting to renderTask 2: Update Invoice PDF Template
Modify the Invoice PDF template to display product images, mirroring the Quote template approach.
custom/templates/invoice_templates/custom.blade.php@foreach ($invoice->items as $item)), add conditional image displayModules/Core/Support/HTML.phpinvoice method)Task 3: Ensure Product Relationship is Loaded for PDF Rendering
Verify and update PDF rendering services to eager load product relationships with images.
Modules/Core/Support/HTML.phpmethods for quote and invoice rendering->with('items.product')quote()andinvoice()methods in the HTML support class🤖 Prompt for AI agents
🚀 Next Steps
🤖 All AI agent prompts combined
💡 Iterate on the plan with:
@coderabbitai <feedback>💬 Have feedback or questions? Drop into our discord!
nielsdrost7 commentedon Jun 13, 2026
Planning Note — v2 Implementation
Story: As a company admin, I want to upload a product image when creating or editing a product, so that the image appears on quotes and invoices to help clients identify exactly what they are purchasing.
v2 context: The
Productmodel is inModules/Products/. v2 has anUploadmodel in Core. The product image should be stored viaUploadServiceand the image URL made available to the invoice/quote PDF blade template.Acceptance Criteria:
storage/company/{company_id}/products/and linked via anUploadpolymorphic record.$product->image_url(accessor).<img>) in the line item row.Implementation:
FileUpload::make('image')toModules/Products/Filament/Company/Resources/Products/Schemas/ProductSchema.php.Product::getImageUrlAttribute(): look up$this->uploads()->first()?->file_pathand returnStorage::url($path).@if($item->product?->image_url && $settings->show_product_images) ``<img src="{{ $item->product->image_url }}" ...>`` @endif.Test Scenarios (PHPUnit + Livewire):
Generated by Claude Code
[-][Feature request] being able to upload one or more Product Images and attach it to quotes and invoices[/-][+][Products]: Upload one or more Product Images for invoice/quote display[/+]