Skip to content

Lifecycle and file metadata

Lifecycle flags live under an entity’s meta mapping:

version: 1
entity:
name: Customer
label: Customer
plural: Customers
meta:
timestamps: true
soft_deletes: true
auditable: true
fields:
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:

Terminal window
php backend-laravel/bin/mettada mettada:integrate Workshop
composer install --working-dir=Workshop/backend
php Workshop/backend/artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php Workshop/backend/artisan migrate

For 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: true

Do 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.