> For the complete documentation index, see [llms.txt](https://waad-mawlood.gitbook.io/model-metadata/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://waad-mawlood.gitbook.io/model-metadata/basics/markdown/forget-metadata.md).

# Forget Metadata

## 🔥 `forgetMetadata`

```php
// Syntax
$model->forgetMetadata(): bool
```

#### Example Usage

```php

// Forget the metadata
if ($model->forgetMetadata()) {
    echo "Metadata successfully forged";
} else {
    echo "No metadata to forget or forgetting failed";
}


$status = $model->forgetMetadata(); // return boolean
// Will be : []

```

{% hint style="info" %} <mark style="color:green;">Return Type ⇒</mark> <mark style="color:orange;">Boolean</mark>
{% endhint %}

***

## 🔥 `forgetKeysMetadata`

Delete specific values by keys from the metadata field.

```php
// Syntax
$model->forgetKeysMetadata(array|Collection|string|int|null $keys = null): bool
```

#### Example Usage

```php

// create metadata
$company->createMetadata(['theme' => 'dark', 'lang' => 'Arabic', 'year' => 1997]);

// Using array keys
$company->forgetKeysMetadata(['theme', 'year']);
// Will become: ['lang' => 'Arabic']

// Using Collection keys
$company->forgetKeysMetadata(collect(['theme', 'year']));

// Using individual key
$company->forgetKeysMetadata('theme');
$company->forgetKeysMetadata(3);   // if metadata list array not associative (keys)

```

<table><thead><tr><th width="202">Parameters</th><th>Data Types</th></tr></thead><tbody><tr><td><mark style="color:red;">keys</mark></td><td><mark style="color:purple;"><code>array, Collection, string, int, null</code></mark></td></tr></tbody></table>

{% hint style="info" %} <mark style="color:green;">Return Type ⇒</mark> <mark style="color:orange;">Boolean</mark>
{% endhint %}

***

## 🔥 `forgetKeyMetadata`&#x20;

{% hint style="warning" %}
It's an Alias of the \`<mark style="color:blue;">forgetKeysMetadata</mark>\` method used for forgetting Individual Key
{% endhint %}

```php
// Syntax
$model->forgetKeyMetadata(string|int|null $key = null): bool
```

#### Example usage

```php
$company->forgetKeyMetadata('theme');

$company->forgetKeyMetadata(4);  // if metadata list array not associative (keys)
```

<table><thead><tr><th width="186">Parameters</th><th>Data Types</th></tr></thead><tbody><tr><td><mark style="color:red;">key</mark></td><td><mark style="color:purple;"><code>string, int, null</code></mark></td></tr></tbody></table>

{% hint style="info" %} <mark style="color:green;">Return Type ⇒</mark> <mark style="color:orange;">Boolean</mark>
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://waad-mawlood.gitbook.io/model-metadata/basics/markdown/forget-metadata.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
