> ## Documentation Index
> Fetch the complete documentation index at: https://docs.advancedtables.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

> Learn how to add the AdvancedTables trait to Resource Tables, Simple Resources, Table Widgets, and Panel Pages.

## Adding Advanced Tables to your table

To use Advanced Tables you will need to add the `AdvancedTables` trait to the appropriate class depending on whether you intend to use it on a [Resource Table](/v5/get-started/getting-started#resource-tables), [Simple Resource Table](/v5/get-started/getting-started#simple-modal-resource-tables), [Table Widget](/v5/get-started/getting-started#table-widgets), or [Panel Page](/v5/get-started/getting-started#panel-pages).

> Important: For standalone Table Builder users, please refer to the documentation for [using Advanced Tables with Table Builder](/v5/table-builder/getting-started).

### Resource tables

To add Advanced Tables to a normal [Resource](https://filamentphp.com/docs/3.x/panels/resources/getting-started) table, add the `AdvancedTables` trait to the [List page](https://filamentphp.com/docs/3.x/panels/resources/listing-records) of your `Resource`:

```php theme={null}
use Archilex\AdvancedTables\AdvancedTables;

class ListProducts extends ListRecords
{
    use AdvancedTables;
```

### Simple (modal) resource tables

To add Advanced Tables to a [Simple (modal) resource](https://filamentphp.com/docs/3.x/panels/resources/getting-started#simple-modal-resources) table, add the `AdvancedTables` trait to the `Manage page`:

```php theme={null}
use Archilex\AdvancedTables\AdvancedTables;

class ManagesCustomers extends ListRecords
{
    use AdvancedTables;
```

### Table Widgets

To add Advanced Tables to a Table Widget, add the `AdvancedTables` trait to the [Table widget](https://filamentphp.com/docs/3.x/panels/dashboard#table-widgets):

```php theme={null}
use Archilex\AdvancedTables\AdvancedTables;

class LatestOrders extends BaseWidget
{
    use AdvancedTables;
```

### Panel Pages

To add Advanced Tables to a [Custom Resource Page](https://filamentphp.com/docs/5.x/resources/custom-pages) or [Custom Page](https://filamentphp.com/docs/5.x/navigation/custom-pages), you need to add the `AdvancedTables` trait to your component. However, as Advanced Tables overrides multiple methods in Filament's `InteractsWithTables` trait, adding the `AdvancedTables` trait to the table will cause a conflict.

For convenience, Advanced Tables includes a `PanelPage` and `CustomPage` class which you can use to quickly get up and running. Of course, there are multiple ways to prevent the trait conflict. The important part is to ensure that the `AdvancedTables` trait is used on a class that extends another class which contains Filament's `InteractsWithTables` trait.

### Custom Resource Page

For [Custom Resource Page](https://filamentphp.com/docs/5.x/resources/custom-pages) you should extend the `PanelPage` class:

```php theme={null}
use Archilex\AdvancedTables\AdvancedTables;
use Archilex\AdvancedTables\Livewire\PanelPage;

class MyCustomResourcePage extends PanelPage
{
    use AdvancedTables;

    ...
```

### Custom Page

For [Custom Page](https://filamentphp.com/docs/5.x/navigation/custom-pages) you should extend the `CustomPage` class:

```php theme={null}
use Archilex\AdvancedTables\AdvancedTables;
use Archilex\AdvancedTables\Livewire\CustomPage;

class MyCustomPage extends CustomPage
{
    use AdvancedTables;

    ...
```

### Adding the view component to your blade file

You also need to add the Favorites Bar component to your panel page's blade file:

```html theme={null}
<div class="flex flex-col gap-6">
    <x-advanced-tables::favorites-bar />

    {{ $this->table }}
</div>
```

The Favorites Bar expects a space of `24px` to properly display it's links. This can easily be achieved with Tailwind's `space-y-6` class as shown above.

## Core Concept: User Views vs Preset Views

Advanced Tables supports both *User Views* and *Preset Views*. Understanding the difference is important to choosing if one or both is appropriate for your application.

**User Views** are created by your end-users using your application's UI. An end-user chooses the appropriate filters, toggled columns, column order, column sort, table grouping, etc. to build the view they need. Then they use Advanced Tables to save that view so they have easy access to it in the future. Since each user has different needs, this allows for infinite customization within your application. (And less work for developers!)

**Preset Views** are views that you the developer write in code and are then available to all your users, (or the users you authorize). Preset Views exposes a `query()` api which allows you to modify the underlying eloquent query. This means you can "filter" a table's data without needing to have that filter on your table.

However, while being able to modify the underlying eloquent query is powerful, and in some cases might be the only way to filter a table, Advanced Tables provides a `filters()` api which allows you to apply values to your existing table filters. This, in turn, offers a better UX for your end-users as they will then see filter indicators in the table and will better understand how a Preset View is modifying the data.

Whether used independently or together, User Views and Preset Views give your end-users quick access to the data they need.
