How aadhil728/quoteflowapp works
Purpose and Entry Points
QuoteFlow AI is a Laravel server-rendered business application for multi-workspace quotation creation, public customer acceptance, invoice conversion, and payment reconciliation. HTTP begins at public/index.php, is composed in bootstrap/app.php, and routes through routes/web.php and routes/auth.php. CLI installation is exposed through artisan and app/Console/Commands/InstallApplicationCommand.php.
Application Boundary and Tenancy
Authenticated requests resolve a current workspace, then enforce role/permission-scoped access before reaching workspace-owned resources. app/Http/Middleware/ResolveWorkspace.php establishes tenant context via app/Support/WorkspaceContext.php; app/Http/Middleware/RequireWorkspacePermission.php protects operations. The tenancy persistence model centers on app/Models/Workspace.php, app/Models/WorkspaceMembership.php, and app/Models/User.php.
Workspace Business Catalogue
Each workspace manages customers, services/categories, templates, branding/settings, and invitations—the source data for quotations. Controllers provide the HTML workflow boundary, notably app/Http/Controllers/CustomerController.php, app/Http/Controllers/ServiceController.php, and app/Http/Controllers/TemplateController.php. Core records include app/Models/Customer.php, app/Models/Service.php, and app/Models/TemplateVersion.php.
Quotation Authoring and Lifecycle
Quotation authoring is the central domain flow: build sections/items/options, calculate monetary values, version/revise, and record lifecycle events/comments. app/Http/Controllers/QuotationController.php drives internal screens; app/Domain/Quotations/MoneyCalculator.php owns calculation logic. Aggregate persistence spans app/Models/Quotation.php, app/Models/QuotationItem.php, and app/Models/QuotationRevision.php, with statuses represented by app/Enums/QuotationStatus.php.
Public Customer Decision Flow
Externally shared quotations use secure public tokens rather than the authenticated workspace surface. app/Http/Controllers/PublicQuotationController.php serves the public document and decision actions, guarded by app/Http/Middleware/SecurePublicDocument.php. Acceptance, option selections, comments, and public-token state are persisted in app/Models/QuotationAcceptance.php, app/Models/QuotationOptionalSelection.php, and app/Models/QuotationPublicToken.php. Public and internal rendering use Blade views under resources/views/public/ and resources/views/quotations/.
Invoice, Payments, and Webhooks
An accepted quotation can be converted into an invoice by app/Actions/ConvertQuotationToInvoice.php; invoices and line items live in app/Models/Invoice.php and app/Models/InvoiceItem.php. Payment lifecycle handling is action-oriented: app/Actions/RecordManualPayment.php, app/Actions/ProcessPaymentWebhook.php, and app/Actions/ReconcileInvoice.php. Provider webhook ingress is app/Http/Controllers/PaymentWebhookController.php; deduplication/audit state is represented by app/Models/PaymentProviderEvent.php and app/Models/Payment.php.
External Integrations and Runtime Infrastructure
PHP/Laravel, Eloquent migrations, session/auth, cache, queues, mail, filesystem storage, and database connections are configured under config/. Payments are abstracted by app/Contracts/PaymentGateway.php, selected through app/Support/PaymentGatewayRegistry.php, with Stripe and PayPal implementations at app/Infrastructure/Payments/StripeGateway.php and app/Infrastructure/Payments/PayPalGateway.php; provider settings reside in config/payments.php. PDFs are isolated behind app/Contracts/PdfRenderer.php with Dompdf at app/Infrastructure/Pdf/DompdfRenderer.php. The frontend is Blade plus Vite-managed CSS/JS (resources/views/, resources/css/, resources/js/app.js).
Main entry points: QuotationController.php Quotation authoring · ResolveWorkspace.php Workspace access gate · ProcessPaymentWebhook.php Payment lifecycle · Quotation.php Quotation aggregate
Components 22
HTTP Application
- Public entry point
public/index.php - Application bootstrap
bootstrap/app.php - Web and auth routes
routes/web.php - Blade user interface · Internal quotations and public document views.
- Application installer
app/Console/Commands/InstallApplicationCommand.php
Workspace Domain
- Workspace access gate · Resolves current workspace and enforces permissions.
app/Http/Middleware/ResolveWorkspace.php - Workspace context
app/Support/WorkspaceContext.php - Workspace membership · Workspace, membership, and user tenancy records.
app/Models/Workspace.php - Workspace catalogue · Customers, services, and templates workflow.
app/Http/Controllers/CustomerController.php - Catalogue records · Customers, services, and template versions.
app/Models/Customer.php
Quotation Flow
- Quotation authoring
app/Http/Controllers/QuotationController.php - Quotation aggregate · Quotations, items, revisions, and lifecycle status.
app/Models/Quotation.php - Money calculator
app/Domain/Quotations/MoneyCalculator.php - Public quotation decision · Serves tokenized document, acceptance, options, and comments.
app/Http/Controllers/PublicQuotationController.php - Public token guard
app/Http/Middleware/SecurePublicDocument.php
Billing & Payments
- Invoice conversion · Creates invoice from an accepted quotation.
app/Actions/ConvertQuotationToInvoice.php - Invoices · Invoices and invoice line items.
app/Models/Invoice.php - Payment webhook ingress
app/Http/Controllers/PaymentWebhookController.php - Payment lifecycle · Manual recording, webhook processing, and invoice reconciliation.
app/Actions/ProcessPaymentWebhook.php - Payment audit records · Payments and provider-event deduplication state.
app/Models/PaymentProviderEvent.php
Integration Adapters
- Payment gateway registry · Selects Stripe or PayPal gateway implementations.
app/Support/PaymentGatewayRegistry.php - PDF renderer · Dompdf-backed document rendering boundary.
app/Contracts/PdfRenderer.php
Connections 22
- Public entry point → Application bootstrap: boots
- Application bootstrap → Web and auth routes: registers
- Web and auth routes → Workspace access gate: authenticated requests
- Workspace access gate → Workspace context: establishes
- Workspace context → Workspace membership: loads tenant
- Workspace access gate → Workspace catalogue: authorizes
- Workspace access gate → Quotation authoring: authorizes
- Workspace catalogue → Catalogue records: manages
- Catalogue records → Quotation authoring: supplies source data
- Quotation authoring → Quotation aggregate: authors and revises
- Quotation authoring → Money calculator: calculates totals
- Quotation authoring → Blade user interface: renders
- Public quotation decision → Public token guard: guarded by
- Public token guard → Quotation aggregate: validates token access
- Public quotation decision → Quotation aggregate: records decisions
- Quotation aggregate → Invoice conversion: accepted quotation
- Invoice conversion → Invoices: creates
- Payment webhook ingress → Payment lifecycle: dispatches
- Payment lifecycle → Payment audit records: records and deduplicates
- Payment lifecycle → Invoices: reconciles
- Payment lifecycle → Payment gateway registry: uses provider
- Quotation authoring → PDF renderer: renders PDFs