Reusable, tenant-agnostic attributes and polymorphic values for Vendra applications.
- Reusable attribute definitions with optional units
- Polymorphic values that can belong to products or any other Eloquent model
- Automatic tenant scoping through
misaf/vendra-supportwhen a tenant resolver is available - Global operation when tenancy is not installed or enabled
- Sortable attributes and values
- Soft deletes
- Filament resource on configured panels
- English, German, and Persian translations
- PHP 8.3+
- Laravel 13
- Filament 5
misaf/vendra-support
composer require misaf/vendra-attribute
php artisan vendor:publish --tag=vendra-attribute-migrations
php artisan migrateOptional configuration and translations:
php artisan vendor:publish --tag=vendra-attribute-config
php artisan vendor:publish --tag=vendra-attribute-translationsThe service provider and Filament plugin are auto-registered.
When misaf/vendra-product is also installed by the host application, its
attribute fields are enabled automatically through the shared Vendra Support
resolver. Neither package requires the other directly.
Add attribute values to an Eloquent model with the provided concern:
use Illuminate\Database\Eloquent\Model;
use Misaf\VendraAttribute\Concerns\HasAttributeValues;
final class Product extends Model
{
use HasAttributeValues;
}Alternatively, a model may extend Misaf\VendraAttribute\Models\AttributableModel.
Create an attribute definition:
use Misaf\VendraAttribute\Models\Attribute;
$weight = Attribute::query()->create([
'name' => 'Weight',
'description' => 'Shipping weight',
'unit' => 'kg',
'status' => true,
]);Assign a value to any attributable model:
$product->attributeValues()->create([
'attribute_id' => $weight->id,
'value' => '1.2',
]);Load values with their definitions:
$product->load('attributeValues.attribute');
foreach ($product->attributeValues as $attributeValue) {
$name = $attributeValue->attribute->name;
$value = $attributeValue->value;
$unit = $attributeValue->attribute->unit;
}The package never depends on a concrete tenant provider. Both Attribute and AttributeValue use the resolver-driven tenancy support from misaf/vendra-support.
- With the default null resolver, records are global and the migrations omit
tenant_id. - When a tenant provider binds an available resolver, migrations add
tenant_id, and models are scoped and stamped automatically.
Do not assign tenant_id manually.
Attribute definitions are managed in the Attributes cluster. By default, the plugin is registered on the admin panel.
Configure panels, the navigation group, and available units in config/vendra-attribute.php after publishing the configuration.
php artisan vendra-attribute:seedWhen tenancy is enabled, an optional tenant ID or slug may be supplied:
php artisan vendra-attribute:seed tenant-slugcomposer test
composer analyseMIT.