{"id":51045295,"url":"https://github.com/whilesmartphp/eloquent-expenses","last_synced_at":"2026-06-22T13:02:14.410Z","repository":{"id":364040205,"uuid":"1219363211","full_name":"whilesmartphp/eloquent-expenses","owner":"whilesmartphp","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-11T11:15:55.000Z","size":61,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"dev","last_synced_at":"2026-06-11T12:20:47.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whilesmartphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T19:56:08.000Z","updated_at":"2026-06-11T11:08:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/whilesmartphp/eloquent-expenses","commit_stats":null,"previous_names":["whilesmartphp/eloquent-expenses"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/whilesmartphp/eloquent-expenses","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-expenses","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-expenses/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-expenses/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-expenses/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whilesmartphp","download_url":"https://codeload.github.com/whilesmartphp/eloquent-expenses/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whilesmartphp%2Feloquent-expenses/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34649822,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-22T13:02:13.059Z","updated_at":"2026-06-22T13:02:14.391Z","avatar_url":"https://github.com/whilesmartphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Eloquent Expenses\n\nPolymorphic expense tracking for Laravel. Money-out counterpart to `whilesmart/eloquent-invoices`.\n\n## Install\n\n```\ncomposer require whilesmart/eloquent-expenses\nphp artisan migrate\n```\n\nAttach `HasExpenses` to the model that owns expenses (workspace / organisation / user):\n\n```php\nuse Whilesmart\\Expenses\\Traits\\HasExpenses;\n\nclass Workspace extends Model\n{\n    use HasExpenses;\n}\n```\n\nAttach `IsVendor` to any model that can be a vendor:\n\n```php\nuse Whilesmart\\Expenses\\Contracts\\Vendor;\nuse Whilesmart\\Expenses\\Traits\\IsVendor;\n\nclass Supplier extends Model implements Vendor\n{\n    use IsVendor;\n}\n```\n\n## Data model\n\nTwo polymorphic relations plus a vendor name snapshot:\n\n- **`owner`** -- who the expense is booked against (required).\n- **`vendor`** -- who was paid, optional polymorphic link (`vendor_type` + `vendor_id`).\n- **`vendor_name`** -- snapshot string; used when there is no linked record, or to preserve the display name at entry time so future vendor renames don't mutate history.\n\nOther fields: `number`, `category`, `description`, `amount_cents`, `tax_cents`, `total_cents`, `currency`, `status` (`draft | submitted | approved | paid | rejected`), `payment_method`, `incurred_at`, `paid_at`, `receipt_url`, `notes`, `metadata`.\n\n## Routes\n\nRegisters an `apiResource` at the configured prefix (default `api`, middleware `['api', 'auth:sanctum']`):\n\n```\nGET    /api/expenses\nPOST   /api/expenses\nGET    /api/expenses/{expense}\nPUT    /api/expenses/{expense}\nDELETE /api/expenses/{expense}\n```\n\nIndex filters: `owner_type`, `owner_id`, `vendor_type`, `vendor_id`, `status`, `category`, `from`, `to`, `q`, `per_page`.\n\n## Relationship to other packages\n\n- **`whilesmart/eloquent-invoices`** -- invoices are money in; expenses are money out. Same polymorphic owner pattern.\n- **`whilesmart/eloquent-payments`** (sibling package) -- when you settle an expense through a gateway, record a `Payment` against the expense. `payment_method` on the expense is a summary; `Payment` records are the audit trail.\n- **`whilesmart/eloquent-customers`** / **`eloquent-organizations`** -- typical models that would implement `Vendor`.\n\n## Config\n\n`php artisan vendor:publish --tag=expenses-config`:\n\n```php\nreturn [\n    'register_routes' =\u003e env('EXPENSES_REGISTER_ROUTES', true),\n    'route_prefix' =\u003e env('EXPENSES_ROUTE_PREFIX', 'api'),\n    'route_middleware' =\u003e ['api', 'auth:sanctum'],\n    'table' =\u003e env('EXPENSES_TABLE', 'expenses'),\n];\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhilesmartphp%2Feloquent-expenses","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhilesmartphp%2Feloquent-expenses","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhilesmartphp%2Feloquent-expenses/lists"}