πGet Metadata
π₯ getMetadata
getMetadataGet metadata column as Array.
Retrieves metadata values from the metadata column. If keys are provided only the specified keys will be returned.
// Syntax
$model->getMetadata(array|Collection|string|int|null $keys = null): arrayExample Usage Without Keys Parameter
// Create Metadata
$model->createMetadata([
'language' => 'English',
'is_visible' => true,
'theme' => 'dark',
'year' => 2019,
'rating' => 4.5,
'tags' => ['action', 'drama'], // array data type
]);
// Using Without keys Parameter
$model->getMetadata();
/**
* Will return array:
* [
* 'language' => 'English',
* 'is_visible' => true,
* 'theme' => 'dark',
* 'year' => 2019,
* 'rating' => 4.5,
* 'tags' => [
* 0 => 'action',
* 1 => 'drama',
* ]
* ]
*/
Example Usage With Keys Parameter
Parameters
Data Types
keys
array, Collection, string, int, null
π₯ getMetadataCollection
It's an Alias getMetadata but retun as Collection
π₯ getKeyMetadata
getKeyMetadataGet individual metadata value by key.
Example Usage
Parameters
Data Types
key
string, int
Last updated