⛱️Sync Metadata

Synchronize metadata for the model.

πŸ”₯ syncMetadata

  • Sync metadata records by replacing all existing ones with new data.

⚠️ cases the operation of this method:

/* 
* This method performs an atomic operation that:
* 1. Deletes all existing metadata records for the model
* 2. Creates new metadata records from the provided data
* 
* The operation will fail and return false if:
* - The provided data is not a valid nested metadata structure
* - The deletion of existing records fails
* 
* If the provided metadata is empty:
* - All existing metadata will be deleted
* - The method will return true
*/ 
// Syntax
$model->syncMetadata(array|Collection $metadata): bool

Example Usage

Parameters
Data Type

metadata

array, Collection

Return Type β‡’ Boolean

Last updated