Enter the tables and columns you want to be accessible by AI
The 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 |
Collections
As described in the concepts page, collections define how Laravel models are synchronized with Vectorify and can use three different syntax patterns. Each collection specifies the data source, field mappings, transformations, and metadata definitions.
The simplest collection configuration references a model class:
This approach uses the model’s $fillable
or a custom $vectorify
property as the column list.
The resource
configuration allows using Laravel API Resources for data transformation:
query
is a callable which returns Illuminate\Database\Eloquent\Builder
.
Complex collections use named keys with configuration arrays:
query
is a callable which returns Illuminate\Database\Eloquent\Builder
.
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 |
Relationships are configured using nested column structures:
Metadata defines additional filterable attributes that are stored separately from the row data.
Metadata can be defined at the column level using the metadata
flag:
Alternatively, metadata can be defined globally, especially when using resource class:
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 |