# insert

**Usage:**

```php
$db->{table}->insert($data);
```

**Example:**

| Table                  | Model              | Database                    |
| ---------------------- | ------------------ | --------------------------- |
| news                   | News               | $db->news                   |
| news\_details          | NewsDetails        | $db->news\_details          |
| news\_attachments\_ids | NewsAttachmentsIds | $db->news\_attachments\_ids |

```php
// First declare your model
// where "News" is your table name in capital case
$data = new News();
$data->name = 'My news';
$data->status = 'ACTIVE';

$news = $db->news->insert($data);
echo json_encode($news);
```

**Return:**

```json
{
    "id": "AUTO_GENERATED_ID",
    "name": "Test News",
    "status": "ACTIVE",
    "created_at": "2024-11-03 21:07:37",
    "updated_at": null,
    "deleted_at": null
}
```
