β±οΈSync Metadata
Synchronize metadata for the model.
π₯ syncMetadata
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): boolExample Usage
Parameters
Data Type
metadata
array, Collection
Last updated