> For the complete documentation index, see [llms.txt](https://jls-organization-3.gitbook.io/projecthyper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jls-organization-3.gitbook.io/projecthyper/features/quickstart/models.md).

# Models

Database models are responsible for creating and map the data for specific table

Models are automatically detected and as time there is a new table created, it also creates or inject the model for that specific table.

**Example:**

For example, we have 3 tables

<table><thead><tr><th width="264">Table</th><th>Fields</th><th>Model</th></tr></thead><tbody><tr><td>news</td><td>id, name, status</td><td>News</td></tr><tr><td>news_details</td><td>id, news_id, content</td><td>NewsDetails</td></tr><tr><td>news_attachments</td><td>id, news_details_id, url</td><td>NewsAttachments</td></tr></tbody></table>

The model part is already introduced here: [insert](/projecthyper/features/quickstart/insert.md)

**Usage:**

```php
$news = new News();
$news->name = 'My News';
$news->status = 'ACTIVE';

$db->news->insert($news);
```

```php
$news = $db->news->findOne(1);
$news->name = 'My News';
$news->status = 'ACTIVE';

$db->news->save($news);
```
