Skip to content

Vendors — Developer Guide

Mirror of the Companies developer guide. Prefer copying those patterns over inventing new ones.

Backend layout

PiecePath
Modelsapp/Models/Vendor.php, VendorNote, VendorActivity
Enumsapp/Enums/Tenant/VendorStatusEnum, VendorActivityTypeEnum
Serviceapp/Services/Tenant/VendorService.php (+ ScopesToAssignee)
Controllerapp/Http/Controllers/Tenant/Api/V1/VendorController.php
Requestsapp/Http/Requests/Tenant/Api/V1/Vendor/*
Resourcesapp/Http/Resources/Tenant/Api/V1/Vendor/*
Policyapp/Policies/VendorPolicy.php
Eventsapp/Events/Vendor*.php
Subscriberapp/Listeners/VendorEventSubscriber.php (audit + assignment notification)
Notificationsapp/Notifications/Tenant/Vendor/VendorAssignedNotification.php
Teststests/Feature/Tenant/Vendor/VendorTest.php

Domain notes

  • Assignee scoping via ScopesToAssignee with vendors.assign; without it, users only see vendors assigned to them (view/update/list/stats).
  • vendors.force.delete is not granted to any default role — owner/superadmin only, matching Companies/Leads/Tasks/Contacts.
  • No contacts relationship — Vendor is a first-class, standalone entity (unlike Companies).
  • No industry, source, or source_meta fields.
  • status enum (active | inactive, default active) replaces the workflow fields used by other modules.
  • Assignee eligibility mirrors Companies (EligibleVendorAssignee / User::isEligibleLeadAssignee).
  • Soft delete only — no stage/status workflow beyond the active/inactive flag.
  • Purchasing hub (v1): VendorPartyPurchasingPanel — PO/expense spend activity (not AP payable). Backend: VendorPartyPurchasingSummaryService, VendorAccountStatementService. Draft + cancelled POs/expenses excluded. Statement includes opening_balance (pre-period activity) and balance_due (cumulative activity as of to). Vendor PDF deferred. List deep links ?vendor= on purchase orders and expenses.

Permissions

config/tenant-permissions.php:

vendors.view | create | update | delete | restore | force.delete | assign

Routes use module:vendors then can:vendors.* / policies.

API (tenant)

Base: /api/tenant/v1 — full reference tenant-v1-vendors.md.

MethodPathPermission
GET/vendorsview
GET/vendors/statsview
GET/vendors/{vendor}view
GET/vendors/{vendor}/timelineview
POST/vendorscreate
PUT/vendors/{vendor}update
DELETE/vendors/{vendor}delete
POST/vendors/{vendor}/restorerestore
DELETE/vendors/{vendor}/forceforce.delete
POST/vendors/{vendor}/assignassign
POST/vendors/{vendor}/notesupdate
GET/vendors/{vendor}/purchasing-summaryview
GET/vendors/{vendor}/statementview

Auth login/me include modules: string[] for SPA gating.

Frontend

PiecePath
Pagesrc/pages/vendors/vendors-page.tsx (table + filters + KPIs)
Formvendor-form.tsx + vendor-form-page.tsx
Detailvendor-view-page.tsx (Details, Notes, Timeline; purchasing hub)
Statementsrc/pages/crm/party-statement-page.tsx (VendorStatementPage)
ServicevendorService in src/api/services.ts (purchasingSummary, statement)
Navpermission: vendors.view, module: 'vendors' — new Purchasing group after Billing
Party purchasingHub + deep links + in-app statement; Pest PartyBilling suite

Tests

bash
# Backend
php artisan test --compact tests/Feature/Tenant/Vendor/VendorTest.php
php artisan test --compact tests/Feature/Tenant/PartyBilling/PartyBillingSummaryAndStatementTest.php

# Frontend
npm run typecheck && npm run lint && npm run build
npm run test:e2e:vendors
SuiteLocation
Pesttests/Feature/Tenant/Vendor/VendorTest.php; PartyBilling suite
E2Ee2e/tests/vendors/, npm run test:e2e:vendors

Logging

  • Spatie LogsActivity on Vendor (log name vendors)
  • Domain vendor_activities timeline
  • PlatformAuditService via VendorEventSubscriber

Intentional differences from Companies

CompaniesVendors
industry, source, source_meta fieldstax_id, payment_terms, currency, status fields
Linked contacts relationshipNo contacts relationship
No status enumstatus enum (active/inactive)
Category: CRMCategory: Purchasing (new)

Deferred

  • Purchase Orders (Phase 4 Milestone 2, depends on Vendors)
  • Expenses (Phase 4 Milestone 3, soft dependency on Vendors)
  • Vendor scorecards / performance tracking
  • Dashboard widgets for Vendors
  • Communication template placeholders for Vendors

Official documentation for the EloSync SaaS Platform.