# Preparing Your Model

To associate Open Graph Image with a model, the model must implement the following interface and trait:

```php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class YourModel extends Model implements HasGraphify
{
    use GraphifyTrait;
}
```

### Graphify Image URL Field

The package assumes you have a nullable string field named `og_image_url` in your model. If you do not have such field, add the following line to your model migration. If your application is in production, you may need to add this to a modification migration.

```php
 $table->string('og_image_url')->nullable();
```

If your model does have such a field but with a different field name, you may override the default by adding the following method to your model.

```php
public function getOpenGraphImageUrlField(): string
{
    return 'your_custom_open_graph_image_url';
}
```


---

# Agent Instructions: 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://ibnnajjaar.gitbook.io/graphify/basic-usage/preparing-your-model.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.
