config/vectorify.php file is the central mechanism for defining how Laravel models are processed and upserted to Vectorify. Through a declarative configuration file, it handles collection (table) definitions, column mappings, metadata extraction, and tenancy configuration.
Global Settings
The configuration file contains several global settings that affect the entire package behaviour:
| Setting | Purpose |
|---|---|
api_key | Authentication token for Vectorify |
tenancy | Tenancy mode: single , multi:column, multi:domain |
collections | Array of collection definitions |
Simple Model Reference
The simplest collection configuration references a model class:$fillable or a custom $vectorify property as the column list.
Resource Class Integration
Theresource configuration allows using Laravel API Resources for data transformation:
query is a callable which returns Illuminate\Database\Eloquent\Builder.
Named Model Columns
Complex collections use named keys with configuration arrays:query is a callable which returns Illuminate\Database\Eloquent\Builder.
Column Configuration
Complex columns use arrays to specify transformation and metadata options:| Option | Purpose | Example |
|---|---|---|
alias | Rename field in output | 'alias' => 'customer_name' |
data | Include in data payload | 'data' => false |
type | Data type for formatting | 'type' => 'datetime' |
format | Date/time formatting | 'format' => 'Y-m-d' |
metadata | Include in metadata | 'metadata' => true |
tenant | Use for multi-tenancy | 'tenant' => true |
relationship | Define a relationship | 'relationship' => true |
Relationship Configuration
Relationships are configured using nested column structures:Metadata Configuration
Metadata defines additional filterable attributes that are stored separately from the row data.Column-Level Metadata
Metadata can be defined at the column level using themetadata flag:
Global Metadata
Alternatively, metadata can be defined globally, especially when using resource class:Metadata Types
Supported metadata types include:| Type | Purpose | Additional Config |
|---|---|---|
string | Text and numeric values | None |
datetime | Date/time values | format option |
enum | Enumerated values | options array |