misaf / vendra-support
Shared support classes for Vendra modules
Requires
- php: ^8.4
- filament/filament: ^5.6.8
- illuminate/console: ^13.0
- illuminate/database: ^13.0
- illuminate/support: ^13.0
- laravel/prompts: ^0.3.21
- symfony/intl: ^7.4 || ^8.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Shared support infrastructure used by every Vendra module.
Features
- Provider-neutral tenant resolution and tenant-awareness helpers
- Tenant-aware Eloquent traits, scopes, and migration helpers
- Optional tag, attribute, and currency integration contracts
- Provider-neutral subscription charging with idempotent operation results
- Plan entitlements:
PlanFeatureandPlanLimitenums, theTenantEntitlementscontract, and theTenantUsageRegistrythat domain packages report their usage to, theTenantLimitOverageslookup for limits a tenant already exceeds, and thePlanUsageWidgetthat shows a store its usage on the admin dashboard and flags any limit it is over - Request and queued-job context propagation primitives
- Shared tenant seeders and console commands
- Shared Filament clusters, navigation taxonomy, and concerns
Settings\RegistersSettings, which lets a package register its own settings classes and settings migrations from its service provider, andFilament\Pages\SystemSettingsPage, the base for a package's store settings page in the admin System clusterIsActiveToggleform field andIsActiveToggleColumntable column for boolean active/inactive columnsIsActiveEntryinfolist entry,IsActiveConstraintquery-builder constraint, andIsActiveFilterternary filter (Active / Inactive) for reading and filtering the same columnsIsDefaultToggleform field,IsDefaultEntryinfolist entry,IsDefaultIconColumntable column,IsDefaultFilterternary filter, andIsDefaultConstraintquery-builder constraint for booleanis_defaultcolumnsIsPrimaryToggleform field andIsPrimaryIconColumntable column for booleanis_primarycolumnsTenancy\TenantAwareness::constrainToCurrentTenant()andconstrainToTenantOf(), which limit a query to one tenant's rows, or to the tenantless rows outside a tenant, where the tenant scope applies nothingObservers\Concerns\MaintainsSingleActiveDefaultobserver trait that keeps exactly one active row flaggedis_defaultper tenant (and one among tenantless rows), promotes the first active row (byordered, else by key) when the default goes away, and clears the flag on a soft-deleted defaultObservers\Concerns\MaintainsSingleFlagPerOwnerobserver trait that keeps exactly one row per owner flagged (for exampleis_defaultoris_primary), gives the flag to an owner's first row, refuses to unflag the only one, and hands it to the oldest remaining row when it is deletedCreatedAtColumn,UpdatedAtColumn,DeletedAtColumn, andRowIndexColumntable columns for timestamps (Jalali under thefalocale) and the#row indexCreatedAtEntry,UpdatedAtEntry, andDateTimeEntryinfolist entries with the same timestamp formatting,IsActiveIconColumn, andPositionConstraint,NameConstraint, andSlugConstraintquery-builder constraintsSluggableNameInput,SlugInput, andDescriptionTextareaform fields,NameEntry,SlugEntry, andDescriptionEntryinfolist entries, andSlugColumnfor the common translated name/slug/description attributesNameColumnandDescriptionColumntable columns and theDescriptionRichEditorJSON rich-text fieldSupport\ContainsSearchfor case-insensitive "contains" searches across columns that treat%and_in the term literally- Composable policy authorization, sandbox helpers, and shared events
The package binds null capability resolvers by default. Concrete providers can replace those bindings without coupling domain packages to their implementations.
Requirements
- PHP 8.4+
- Laravel 13
- Filament 5
misaf/filament-jalali
Installation
composer require misaf/vendra-support
The service provider is auto-registered.
Optionally publish the shared panel configuration:
php artisan vendor:publish --tag=vendra-support-config
A module registers its seed command class with Tenancy\TenantSeeders
(register(SeedCommand::class, priority: 30)). When a store is provisioned with
seeding, Tenancy\Listeners\RunTenantSeeders runs every registered command's
static seeders() directly inside the new tenant, not through Artisan, so seed
commands are registered with hasConsoleCommand() and provisioning still seeds
inside a web request.
Demo seeders use bundled JSON fixtures in production and when their declared factory classes are unavailable. Local monorepo development continues to use factories when they are autoloadable.
Testing
Run the package checks from the project root:
php artisan test --compact --testsuite=vendra-support
composer stan
License
MIT. See LICENSE.