Create, modify, review, or test the Vendra Affiliate API package in packages/vendra-affiliate-api. Use for the public affiliates JSON:API server, AffiliateSchema, AffiliateResource, collection/resource queries, active-affiliate visibility, filters, routes, response fields, API tests, and AffiliateApiServiceProvider wiring.
التثبيت
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Create, modify, review, or test the Vendra Affiliate API package in packages/vendra-affiliate-api. Use for the public affiliates JSON:API server, AffiliateSchema, AffiliateResource, collection/resource queries, active-affiliate visibility, filters, routes, response fields, API tests, and AffiliateApiServiceProvider wiring.
Vendra Affiliate API
Workflow
Translatable Persistence
Making a persisted model field translatable is an explicit domain choice unless this package already requires it.
Every field listed in a model's $translatable array must definitely use a JSON database column. Keep its model traits/casts, factories, validation, Filament locale UI, API serialization, and tests translation-aware.
A field not listed in $translatable must use the appropriate scalar database type and must not use Spatie Translatable, translatable slug traits, locale switchers, translated callbacks, or translation-shaped array data.
Use vendra-api-development for shared JSON:API infrastructure, laravel-best-practices for Laravel PHP and pest-testing when tests change. Before editing, inspect the installed versions with Laravel Boost and search the version-specific documentation for the affected JSON:API behavior.
Boundary And Contract
Work inside packages/vendra-affiliate-api with namespace Misaf\VendraAffiliateApi.
Reuse Misaf\VendraAffiliate\Models\Affiliate; do not duplicate affiliate persistence, status transitions, commissions, referrals, or payouts.
Preserve the public read-only contract: expose active affiliates only and serialize only code and created_at.
Apply active status in AffiliateSchema::newQuery() so index, filter, and show endpoints cannot diverge.
Keep filters intentionally narrow and never expose user relationships or financial fields.
Inherit tenant scoping from the domain model and keep the production Misaf\VendraAffiliateApi namespace free of Misaf\VendraTenant. Feature tests may use a concrete tenant factory solely to establish tenant context.
Change Checklist
Update the schema, resource, collection/resource queries, server, and routes together when the contract changes.
Add focused Pest coverage for public fields, active/suspended visibility, filtering, pagination, routes, and server schema registration.
Preserve the architecture expectation that Misaf\VendraAffiliateApi does not use Misaf\VendraTenant.
Run composer --working-dir=packages/vendra-affiliate-api test and composer --working-dir=packages/vendra-affiliate-api analyse; run Pint when PHP changes.