Lifecycle and file metadata
Lifecycle and file metadata
Section titled “Lifecycle and file metadata”Lifecycle flags live under an entity’s meta mapping:
version: 1entity: name: Customer label: Customer plural: Customersmeta: timestamps: true soft_deletes: true auditable: truefields: name: type: string required: true| Flag | Default | Generated effect |
|---|---|---|
timestamps |
true |
Controls Eloquent timestamp handling and timestamp migration columns. |
soft_deletes |
false |
Adds Eloquent SoftDeletes support and a deleted_at column. |
auditable |
false |
Adds Spatie Activitylog’s model logging integration. |
The flags are independent. Enabling auditable causes mettada:integrate to
add the Composer package when integrating the consumer. Then install the
consumer dependencies, publish the package migration, and migrate:
php backend-laravel/bin/mettada mettada:integrate Workshopcomposer install --working-dir=Workshop/backendphp Workshop/backend/artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"php Workshop/backend/artisan migrateFor one uploaded file, use a type: file field. The generated Laravel request
validates the upload, generated controllers store it on Laravel’s public
disk under uploads/<entity>/, and persistence stores the resulting path.
Create Laravel’s public storage link and configure the disk before exposing
uploaded files.
reference_photo: type: file required: false nullable: trueDo not assume that soft deletion automatically hides records from every custom query, that activity logs define a full audit-retention policy, or that a file upload is safe to serve publicly. Confirm generated behavior and add consumer tests appropriate to your access policy.