πŸ•Get Metadata

πŸ”₯ getMetadata

Get 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): array

Example 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

Return Type β‡’ array


πŸ”₯ getMetadataCollection


πŸ”₯ getKeyMetadata

Get individual metadata value by key.

Example Usage

Parameters
Data Types

key

string, int

Return Type β‡’ array, string, int, float, bool, null

Last updated