---
title: Repository
---

# Repository

<div class="documentation__toc"></div>

## Introduction

Table repositories are used to create an `entry` when creating and to update an `entry` when editing. The repository is guessed based on the type of model used.

> Custom repositories are a rare need.{.note}

If you would like to or need to define the repository yourself you can do so on the table builder.

```php
protected $repository = \Example\Test\FancyTableRepository::class;
```

You can also set an instantiated repository on the builder dynamically:

```php
$builder->setRepository(app(MyTableRepository::class);
```

The table repository must implement `\Anomaly\Streams\Platform\Ui\Table\Contract\TableRepositoryInterface` and implement the following method:

```php
/**
 * Get the table entries.
 *
 * @param  TableBuilder $builder
 * @return Collection
 */
public function get(TableBuilder $builder);
```
