### Authenticate and Install Package Source: https://docs.advancedtables.com/v5/get-started/installation Set up authentication credentials for the private repository and install the Advanced Tables package via Composer. ```bash composer config --auth http-basic.advancedtables.privato.pub "[license-email]" "[license-key]" composer require archilex/filament-filter-sets ``` -------------------------------- ### Database and Asset Setup Source: https://docs.advancedtables.com/v5/get-started/installation Publish migrations and language files, then execute database migrations to prepare the application for Advanced Tables. ```bash php artisan vendor:publish --tag="advanced-tables-migrations" php artisan migrate php artisan vendor:publish --tag="advanced-tables-translations" ``` -------------------------------- ### Customizing the Preset View Label Source: https://docs.advancedtables.com/v5/features/preset-views Examples showing how to customize the label for a Preset View, either by passing it directly to the `make()` method or using the `label()` method. ```APIDOC ## Customizing the Preset View label By default the array keys will be used as the labels for each Preset View. This may be configured by passing a label into the `make()` method: ```php theme={null} 'processing' => PresetView::make('Processing orders') ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ``` If you prefer, you may also use the `label()` method: ```php theme={null} 'processing' => PresetView::make() ->label('Processing orders') ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ``` ``` -------------------------------- ### Creating a Preset View Source: https://docs.advancedtables.com/v5/features/preset-views This example demonstrates how to create two preset views, 'processing' and 'delivered', by modifying the underlying Eloquent query. ```APIDOC ## Creating a Preset View To create a Preset View, add the `getPresetView()` method to your `List*`, `Manage*`, or table widget class. ```php theme={null} use Archilex\AdvancedTables\Components\PresetView; use Archilex\AdvancedTables\AdvancedTables; class ListOrders extends ListRecords { use AdvancedTables; public function getPresetViews(): array { return [ 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')), 'delivered' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'delivered')), ]; } } ``` The Preset View `modifyQueryUsing()` method modifies your original eloquent query by applying the scopes and conditions you configure. ``` -------------------------------- ### Configure Initial User View Status (PHP) Source: https://docs.advancedtables.com/v5/features/user-views Sets the initial status for a User View when it's created. This configuration is part of the AdvancedTablesPlugin setup and determines the starting state of a new user view. ```php AdvancedTablesPlugin::make() ->initialStatus(Archilex\AdvancedTables\Enums\Status::Rejected) ``` -------------------------------- ### Run Artisan Command for Multi-Tenancy Setup Source: https://docs.advancedtables.com/v5/multi-tenancy/multi-tenancy This command is used to add and run necessary migrations for setting up multi-tenancy in Advanced Tables. It's a common step regardless of the multi-tenancy implementation method chosen. ```bash php artisan advanced-tables:add-tenancy ``` -------------------------------- ### Advanced Search Configurations Source: https://docs.advancedtables.com/v5/features/advanced-search Provides examples of how to configure various aspects of the Advanced Search functionality within the `AdvancedTablesPlugin`. ```APIDOC ## AdvancedTablesPlugin Configuration ### Description Customizes the behavior and appearance of the Advanced Search feature. ### Method Configuration methods on `AdvancedTablesPlugin::make()` ### Endpoint N/A (Configuration within `PanelProvider`) ### Configurations #### Dropdown Column Order To show columns before constraints in the advanced search dropdown: ```php AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchDropdownColumnsFirst() ``` #### Opening Dropdown on Focus To automatically open the advanced search dropdown when the input receives focus: ```php AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchDropdownOpenOnFocus() ``` #### Keybindings To configure keyboard shortcuts to focus the search input: ```php AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchKeybindings(['command+k', 'ctrl+k']) ``` #### Customizing the Trigger Action To customize the appearance and tooltip of the Advanced Search trigger button: ```php use Filament urterActions\Action; AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchTriggerAction(function (Action $action) { return $action ->icon('heroicon-s-magnifying-glass') ->tooltip('Search options') ->color('primary'); }) ``` #### Customizing Labels Labels for Advanced Search can be customized by publishing and editing the language files. Locate the `advanced_search` section in the `advanced-tables.php` language file. ``` -------------------------------- ### Select Filter Configuration in PHP Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder This example shows the configuration of the SelectFilter, which combines Filament's SelectFilter with additional operators such as 'is', 'is not', 'is empty', and 'is not empty' for filtering select-type columns. ```php // Example usage within filters array AdvancedFilter::make() ->filters([ SelectFilter::make('select_column'), ]) ``` -------------------------------- ### Configure User Name and Primary Key Columns Source: https://docs.advancedtables.com/v5/configuration/additional-configurations Allows mapping of custom name columns and primary keys for user identification. Includes an example of creating a virtual column for full name concatenation. ```php $table->string('full_name')->virtualAs('concat(first_name, \' \', last_name)'); AdvancedTablesPlugin::make() ->userTableNameColumn('full_name') ->userTableKeyColumn('uuid') ``` -------------------------------- ### Numeric Filter Configuration in PHP Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder This example shows how to configure the NumericFilter for filtering numerical data. It supports operators like 'equal to', 'greater than', 'less than or equal to', and 'between'. ```php // Example usage within filters array AdvancedFilter::make() ->filters([ NumericFilter::make('numeric_column'), ]) ``` -------------------------------- ### Configure TextFilter with Relationship in PHP Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder This example demonstrates configuring a TextFilter to use a relationship for its options. It allows filtering based on related data, such as 'customer.name', and supports multiple selections and preloading. ```php AdvancedFilter::make() ->filters([ TextFilter::make('customer.name') ->relationship(name: 'customer', titleAttribute:'name') ->multiple() ->preload(), ]) ``` -------------------------------- ### Configure Specific Column Filters in PHP Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder This example shows how to selectively include or exclude specific columns for filtering when using the Advanced Filter Builder in PHP. This allows for fine-grained control over which columns generate filters. ```php # Include specific columns AdvancedFilter::make() ->include(['column1', 'column2']) # Exclude specific columns AdvancedFilter::make() ->exclude(['column3', 'column4']) ``` -------------------------------- ### Customize View Manager Trigger Action Source: https://docs.advancedtables.com/v5/features/view-manager This example illustrates how to customize the appearance and behavior of the View Manager trigger button using the `viewManagerTriggerAction()` method, similar to Filament's trigger action customization. ```php use Filament\Actions\Action; use Filament\Support\Icons\Heroicon; AdvancedTablesPlugin::make() ->viewManagerTriggerAction(function (Action $action) { return $action ->button() ->label('Views') ->icon(Heroicon::OutlinedSquares2x2) ->color('primary'); }) ``` -------------------------------- ### Displaying a Preset View with a Color Source: https://docs.advancedtables.com/v5/features/preset-views Illustrates how to apply a color to a Preset View using the `color()` method. ```APIDOC ## Display the Preset View with a color Similar to User Views, Preset Views may be displayed in a color. ```php theme={null} 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->color('warning'), ``` You may choose any of Filament's [default colors](https://filamentphp.com/docs/3.x/support/colors#customizing-the-default-colors), `primary`, `success`, `info`, `warning`, `danger`, `gray`. You may also include any [extra colors you have previously registered in Filament](https://filamentphp.com/docs/3.x/support/colors#registering-extra-colors): ``` -------------------------------- ### Apply Default Search to Preset Views (PHP) Source: https://docs.advancedtables.com/v5/features/advanced-search Demonstrates how to apply default search settings to preset views using the `defaultSearch()` method. It shows how to define single and multi-group searches with various constraints and operators. ```php 'active_orders' => PresetView::make('Active Orders') ->defaultSearch([ [ 'columns' => [], 'constraint' => 'contains', 'value' => 'pending', 'operator' => null, ], ]) ``` ```php 'active_orders' => PresetView::make('Active Orders') ->defaultSearch([ [ 'columns' => ['status'], 'constraint' => 'equals', 'value' => 'active', 'operator' => null, ], [ 'columns' => ['name'], 'constraint' => 'contains', 'value' => 'John', 'operator' => 'or', ], ]) ``` ```php ->defaultSearch('pending') ``` -------------------------------- ### Configure View Manager Position in Favorites Bar Source: https://docs.advancedtables.com/v5/features/view-manager This code snippet demonstrates how to position the View Manager at the start of the Favorites Bar using the `viewManagerInFavoritesBar()` method. ```php AdvancedTablesPlugin::make() ->viewManagerInFavoritesBar(position: 'start') ``` -------------------------------- ### Publish Configuration Files (Bash) Source: https://docs.advancedtables.com/v5/get-started/installation Publishes the configuration files for Advanced Tables. This is recommended for customization, especially if using non-default user models or tables. ```bash php artisan vendor:publish --tag="advanced-tables-config" ``` -------------------------------- ### Configure Preset View Badges and Colors Source: https://docs.advancedtables.com/v5/features/preset-views Demonstrates how to add a dynamic count badge to a Preset View and customize its color using the badge() and badgeColor() methods. ```php 'processing' => PresetView::make() ->badge(Order::query()->where('status', 'processing')->count()) ->badgeColor('warning') ``` -------------------------------- ### Configure Advanced Tables Plugin Source: https://docs.advancedtables.com/v5/features/user-views Demonstrates how to initialize the AdvancedTablesPlugin within a Filament PanelProvider, including disabling user views. ```php public function panel(Panel $panel): Panel { return $panel ->plugins([ AdvancedTablesPlugin::make() ->userViewsEnabled(false) ]); } ``` -------------------------------- ### Apply default search to Preset View Source: https://docs.advancedtables.com/v5/features/preset-views Uses the defaultSearch method to set a starting search term for a Preset View. When Advanced Search is enabled, this string is automatically converted to a 'contains' constraint. ```php 'active_orders' => PresetView::make('Active Orders') ->defaultSearch('pending') ``` -------------------------------- ### Enable Table Loading Overlay Source: https://docs.advancedtables.com/v5/configuration/additional-configurations Enables a skeleton loading overlay for tables to improve user feedback during data fetching. Requires running build and upgrade commands after implementation. ```php AdvancedTablesPlugin::make() ->tableLoadingOverlay() ``` -------------------------------- ### Configure Tenancy in Config File Source: https://docs.advancedtables.com/v5/multi-tenancy/simple-tenancy Set up simple tenancy for Advanced Tables by specifying the tenant model class within the 'advanced-tables.php' configuration file. This is used for Filament's standalone Table Builder. ```php 'tenancy' => [ 'tenant' => App\Models\Team::class, ] ``` -------------------------------- ### Preset Views - Default Search Configuration Source: https://docs.advancedtables.com/v5/features/advanced-search Demonstrates how to apply default search settings to Preset Views using the `defaultSearch()` method. It shows configurations for single and multi-group searches with different constraints and operators. ```APIDOC ## POST /websites/advancedtables_v5/preset-views/defaultSearch ### Description Applies default search settings to a Preset View. ### Method POST ### Endpoint `/websites/advancedtables_v5/preset-views/{presetViewName}/defaultSearch` ### Parameters #### Request Body - **search** (string | array | Closure) - Required - The default search configuration. Can be a simple string, an array of search group objects, or a Closure. ### Request Example (Single Group) ```php 'active_orders' => PresetView::make('Active Orders') ->defaultSearch([ [ 'columns' => [], 'constraint' => 'contains', 'value' => 'pending', 'operator' => null, ], ]) ``` ### Request Example (Multi-Group) ```php 'active_orders' => PresetView::make('Active Orders') ->defaultSearch([ [ 'columns' => ['status'], 'constraint' => 'equals', 'value' => 'active', 'operator' => null, ], [ 'columns' => ['name'], 'constraint' => 'contains', 'value' => 'John', 'operator' => 'or', ], ]) ``` ### Search Group Structure - **columns** (string[]) - Optional - Column names to search. Empty array searches all columns. - **constraint** (string) - Required - The search constraint (e.g., 'contains', 'equals', 'starts_with'). - **value** (string) - Required - The search term. - **operator** (string | null) - Optional - 'and', 'or', or null for the first group. ``` -------------------------------- ### Add Tooltips to Preset Views Source: https://docs.advancedtables.com/v5/features/preset-views Shows how to attach a descriptive tooltip to a Preset View, which appears when the user hovers over the item in the Favorites Bar. ```php 'lowStock' => PresetView::make() ->modifyQueryUsing(Product::query()->where('price', '>', 1000)->where('qty', '<', 5)) ->tooltip('High price products with low stock') ``` -------------------------------- ### Change Quick Save Position in Favorites Bar Source: https://docs.advancedtables.com/v5/features/quick-save Control the position of the Quick Save button within the Favorites Bar. By default, it appears at the end. Set `position` to 'start' to place it at the beginning of the bar. ```php AdvancedTablesPlugin::make() ->quickSaveInFavoritesBar(position: 'start') ``` -------------------------------- ### Adding an Icon to a Preset View Source: https://docs.advancedtables.com/v5/features/preset-views Shows how to assign an icon to a Preset View using the `icon()` method. ```APIDOC ## Adding an icon Similar to User Views, Preset Views may have icons: ```php theme={null} 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->icon('heroicon-o-refresh'), ``` By default the icon will be displayed before the name. This [can be configured](/v5/features/favorites-bar#icon-position) in the Favorites Bar settings. ``` -------------------------------- ### Enable Quick Filters in Panel Provider Source: https://docs.advancedtables.com/v5/features/quick-filters Enables the Quick Filters functionality globally within your Filament panel provider configuration. ```php AdvancedFilter::make() ->quickFiltersEnabled() ``` -------------------------------- ### Compile Theme and Run Filament Upgrade Source: https://docs.advancedtables.com/v5/get-started/upgrading This sequence of bash commands first compiles your theme assets using npm and then executes the Filament upgrade command. These are essential steps to finalize the upgrade process to Advanced Tables v5. ```bash npm run build php artisan filament:upgrade ``` -------------------------------- ### Configure Tenancy with Filament Panels Source: https://docs.advancedtables.com/v5/multi-tenancy/simple-tenancy Integrate Advanced Tables tenancy with Filament Panels by passing the tenant model class to the AdvancedTablesPlugin. This ensures that user views are correctly scoped to their respective tenants. ```php AdvancedTablesPlugin::make() ->tenant(Team::class) ``` -------------------------------- ### Apply Color to Preset View (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Shows how to assign a color ('warning') to a Preset View using the `color()` method. This Preset View filters records with a 'processing' status. ```php 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->color('warning'), ``` -------------------------------- ### Configure Custom Theme Styles Source: https://docs.advancedtables.com/v5/get-started/installation Import the plugin's CSS and add source paths to your custom Filament theme configuration file. ```css @import '../../../../vendor/filament/filament/resources/css/theme.css'; @import '../../../../vendor/archilex/filament-filter-sets/resources/css/plugin.css'; @source '../../../../app/Filament'; @source '../../../../resources/views/filament'; @source '../../../../vendor/archilex/filament-filter-sets'; ``` -------------------------------- ### Toggling and Reordering Columns Source: https://docs.advancedtables.com/v5/features/preset-views This snippet demonstrates how to set default columns for a Preset View using the `defaultColumns()` method. It also explains how column visibility and order are managed based on Reorderable Columns and toggleable settings. ```APIDOC ## Toggling and reordering columns Preset Views can toggle and reorder columns as well using the `defaultColumns()` method: ```php 'processing' => PresetView::make() ->defaultColumns(['id', 'status', 'customer.name', 'created_at']) ``` Columns will be saved in the following ways: * If Reorderable Columns are enabled, Advanced Tables will sort the columns in the order they are included in the `defaultColumns()` array. * If a column is not included in the array and is `toggleable()`, it will be hidden. * If a column is not included in the array and is not `toggleable()`, it will be added to the end of the table. ``` -------------------------------- ### Configure Quick Save Active Preset View Helper Text Source: https://docs.advancedtables.com/v5/features/preset-views This snippet shows how to activate the helper text that informs users when a Preset View is used as the base for a User View, and that its filtering cannot be removed. The text itself can be further configured in the language files. ```APIDOC ## Activate Quick Save Active Preset View Helper Text ### Description Enables a helper text within the Save View slideOver or modal. This text clarifies that the user is basing their new User View on a Preset View and that filtering from the Preset View cannot be altered. ### Method This is a configuration method, not a direct HTTP request. ### Endpoint N/A ### Parameters N/A ### Request Example ```php AdvancedTablesPlugin::make() ->quickSaveActivePresetViewHelperText() ``` ### Response N/A (This is a configuration method) ### Error Handling N/A ``` -------------------------------- ### Apply Default Table Filters Source: https://docs.advancedtables.com/v5/features/preset-views Illustrates how to set default filters for a table using the defaultFilters() method, which automatically updates filter indicators for the user. ```php 'new_this_quarter' => PresetView::make() ->defaultFilters([ 'status' => ['value' => 'new'], 'created_at' => ['range' => 'this_quarter'], ]) ``` -------------------------------- ### Loading a Default Preset View Source: https://docs.advancedtables.com/v5/features/preset-views This snippet shows how to designate a specific Preset View as the default when a page loads using the `default()` method. It also covers using a callback for dynamic default view selection. ```APIDOC ## Loading a default Preset View You may choose one of your Preset Views as the default view when loading the page by using the `default()` method: ```php 'processing' => PresetView::make() ->default() ``` `default()` can take a callback which can allow you to dynamically choose which Preset View is the default based on the conditions you choose. The first Preset View that returns `true` will be the view that is loaded by default. ``` -------------------------------- ### Publish Language Files Source: https://docs.advancedtables.com/v5/configuration/additional-configurations Publishes the translation files to the local project directory to allow for text customization and localization. ```bash php artisan vendor:publish --tag=advanced-tables-translations ``` -------------------------------- ### Using Standard Filters with Advanced Filter Builder Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder Demonstrates how to combine Filament's standard filters with the Advanced Filter Builder. Filters are added to the table's `->filters()` method, allowing both regular filters and the Advanced Filter Builder to be present. ```php return $table ->columns([ ... ]) ->filters([ Filter::make('is_active') ->query(fn (Builder $query): Builder => $query->where('is_active', true)) ->toggle(), AdvancedFilter::make(), ]) ``` -------------------------------- ### Implement Single Indicator for Multi-Field Filter Source: https://docs.advancedtables.com/v5/features/quick-filters Demonstrates how to use the indicateUsing method to return a single Indicator instance based on multiple form field inputs. This approach consolidates the filter state into one UI element. ```php Filter::make('created_at') ->form([ DatePicker::make('created_from'), DatePicker::make('created_until'), ]) ->query(function (Builder $query, array $data): Builder { ... }) ->indicateUsing(function (array $data): ?Indicator { if (($data['created_from'] ?? null) && (! ($data['created_until'] ?? null))) { return Indicator::make('Created from ' . Carbon::parse($data['created_from'])->toFormattedDateString()); } if ((! ($data['created_from'] ?? null)) && ($data['created_until'] ?? null)) { return Indicator::make('Created until ' . Carbon::parse($data['created_until'])->toFormattedDateString()); } if (($data['created_from'] ?? null) && ($data['created_until'] ?? null)) { return Indicator::make('Created between ' . Carbon::parse($data['created_from'])->toFormattedDateString() . ' and ' . Carbon::parse($data['created_until'])->toFormattedDateString()); } return null; }) ``` -------------------------------- ### Explicitly Configure Indicator Display Mode Source: https://docs.advancedtables.com/v5/features/quick-filters Shows how to force the indicator display behavior using the multipleIndicators method when automatic detection is insufficient. ```php // Display as a single indicator Filter::make('created_at') ->multipleIndicators(false); // Display as multiple indicators Filter::make('created_at') ->multipleIndicators(); ``` -------------------------------- ### Configuring Preset Views Source: https://docs.advancedtables.com/v5/features/preset-views This snippet shows how to configure Preset Views at the plugin level, specifically how to disable the creation of new Preset Views using `createUsingPresetView(false)`. ```APIDOC ## Preset Views configurations Advanced Tables offers multiple ways to customize Preset Views. Unless specified otherwise, these options can be configured directly on the `AdvancedTablesPlugin` object inside your `PanelProvider`: ```php public function panel(Panel $panel): Panel { return $panel ->plugins([ AdvancedTablesPlugin::make() ->createUsingPresetView(false) ]) ``` ``` -------------------------------- ### Create Livewire Component for User Views Source: https://docs.advancedtables.com/v5/table-builder/managing-user-views Generates a new Livewire component using the Artisan command. This component will be used to manage user views within the Filament Table Builder. ```bash php artisan make:livewire ListUserViews ``` -------------------------------- ### Configure Advanced Search Keybindings (PHP) Source: https://docs.advancedtables.com/v5/features/advanced-search Sets custom keyboard shortcuts for focusing the Advanced Search input. The `advancedSearchKeybindings()` method accepts an array of key combinations. ```php AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchKeybindings(['command+k', 'ctrl+k']) ``` -------------------------------- ### Configure User Views Resource Settings Source: https://docs.advancedtables.com/v5/features/user-views-resource A collection of methods to configure the User Views resource behavior, including enabling/disabling the resource, customizing navigation icons, groups, sorting, badges, and user loading performance. ```php AdvancedTablesPlugin::make() ->resourceEnabled(false) ->resourceNavigationIcon('heroicon-o-star') ->resourceNavigationGroup('Settings') ->resourceNavigationSort(1) ->resourceNavigationBadge(false) ->resourceLoadAllUsers(false) ``` -------------------------------- ### Manage Preset View Visibility Source: https://docs.advancedtables.com/v5/features/preset-views Explains how to control the visibility of Preset Views using closure-based logic or Laravel policies to restrict access based on user roles. ```php 'processing' => PresetView::make() ->visible(fn (Order $record): bool => auth()->user()->can('viewProcessing', $record)); public function viewProcessing(User $user) { return $user->isAdmin(); } ``` -------------------------------- ### Configuring the Managed Preset View Class Source: https://docs.advancedtables.com/v5/features/preset-views This snippet demonstrates how to specify a custom class for managing Preset View configurations (visibility and sorting) between users and Preset Views using the `managedPresetView()` method. ```APIDOC ### Configuring the Managed Preset View class The `ManagedPresetView` class is responsable for storing the visibility and sorting configurations between a `User` and a `PresetView`. If you need to extend this class, you may pass your custom class to `managedPresetView()`: ```php AdvancedTablesPlugin::make() ->managedPresetView(myCustomManagedPresetView::class) ``` ``` -------------------------------- ### Implement Multiple Indicators for Multi-Field Filter Source: https://docs.advancedtables.com/v5/features/quick-filters Demonstrates how to return an array of Indicator instances, allowing each form field to have its own independent indicator and removal action. ```php Filter::make('published_at') ->form([ DatePicker::make('published_from'), DatePicker::make('published_until'), ]) ->query(function (Builder $query, array $data): Builder { ... }) ->indicateUsing(function (array $data): array { $indicators = []; if ($data['published_from'] ?? null) { $indicators[] = Indicator::make('Published from ' . Carbon::parse($data['published_from'])->toFormattedDateString()) ->removeField('published_from'); } if ($data['published_until'] ?? null) { $indicators[] = Indicator::make('Published until ' . Carbon::parse($data['published_until'])->toFormattedDateString()) ->removeField('published_until'); } return $indicators; }) ``` -------------------------------- ### Publish and Run Advanced Tables Migrations Source: https://docs.advancedtables.com/v5/get-started/upgrading These bash commands are used to publish the migration files for Advanced Tables and then run the database migrations. This step is necessary to update user views to support the new table structure in v5. ```bash php artisan vendor:publish --tag="advanced-tables-migrations" php artisan migrate ``` -------------------------------- ### Configure Favorites Bar and View Manager Integration Source: https://docs.advancedtables.com/v5/features/view-manager Configure the Favorites Bar to hide the Quick Save button and display the View Manager save functionality, while also placing the View Manager directly in the table. This configuration is relevant when `viewManagerSaveView()` is used. ```php AdvancedTablesPlugin::make() ->quickSaveInFavoritesBar(false) ->viewManagerInFavoritesBar(false) ->viewManagerInTable() ->viewManagerSaveView() ``` -------------------------------- ### Add Icon to Preset View (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Demonstrates adding an icon ('heroicon-o-refresh') to a Preset View using the `icon()` method. This Preset View applies a 'processing' status filter to the query. ```php 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->icon('heroicon-o-refresh'), ``` -------------------------------- ### Enable Quick Save Preset View Helper Text in PHP Source: https://docs.advancedtables.com/v5/features/preset-views This code snippet demonstrates how to enable the helper text that informs users when a Preset View is used as the base for a User View. This text explains that filtering from the Preset View cannot be removed and is configurable in the language files. ```php AdvancedTablesPlugin::make() ->quickSaveActivePresetViewHelperText() ``` -------------------------------- ### Configure Icon Picker Settings Source: https://docs.advancedtables.com/v5/features/user-views Controls the visibility of the icon picker and restricts the inclusion of solid or outline icons in the UI. ```php AdvancedTablesPlugin::make() ->quickSaveIconSelect(false) ->quickSaveIncludeSolidIcons(false) ``` -------------------------------- ### Publish Language Files (Bash) Source: https://docs.advancedtables.com/v5/get-started/installation Optionally publishes the language files for Advanced Tables, allowing for translation customization. ```bash php artisan vendor:publish --tag="advanced-tables-translations" ``` -------------------------------- ### Configure Advanced Tables for Third-Party Tenancy in Config Source: https://docs.advancedtables.com/v5/multi-tenancy/multi-tenancy Configure multi-tenancy for Filament's standalone Table Builder when using third-party packages. This involves setting the tenant model within the advanced-tables.php configuration file. ```php 'tenancy' => [ 'tenant' => \Spatie\Multitenancy\Models\Tenant::class, ] ``` -------------------------------- ### SQL Representation of Grouped Search Source: https://docs.advancedtables.com/v5/features/advanced-search Demonstrates how logical groupings in the search interface translate into SQL WHERE clauses. AND logic keeps conditions within the same clause, while OR logic creates separate clauses. ```sql WHERE (name LIKE '%John%' AND email LIKE '%gmail%') OR (status = 'active') ``` -------------------------------- ### Show/Hide Helper Text for User Views - PHP Source: https://docs.advancedtables.com/v5/features/user-views Controls the visibility of helper text for various user view creation/editing toggles like 'Favorite', 'Public', and 'Global Favorite'. Each toggle has a corresponding method (e.g., `quickSaveNameHelperText()`) that accepts `true` or `false` to show or hide the text. ```php AdvancedTablesPlugin::make() ->quickSaveNameHelperText(false) ->quickSaveFiltersHelperText(false) ->quickSavePublicHelperText(false) ->quickSaveFavoriteHelperText(false) ->quickSaveGlobalFavoriteHelperText(false) ``` -------------------------------- ### Load a default Preset View Source: https://docs.advancedtables.com/v5/features/preset-views Sets a specific Preset View as the default when the page loads using the default method. This can accept a callback for dynamic selection. ```php 'processing' => PresetView::make() ->default() ``` -------------------------------- ### Display Query Indicator for Preset Views Source: https://docs.advancedtables.com/v5/features/preset-views Adds a descriptive badge to preset views, indicating how the view modifies the table's query. This helps users understand the scope of filters applied by the preset view. The text for the indicator is passed to the `indicator()` method. ```php 'honor_roll_students' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->perfectAttendance() ->perfectGrades() ->withoutBehaviorReports() ) ->indicator('students with perfect attendance, grades, and behavior') ``` -------------------------------- ### Adding a Preset View to the Favorites Bar Source: https://docs.advancedtables.com/v5/features/preset-views Demonstrates how to add a Preset View to the Favorites Bar using the `favorite()` method. ```APIDOC ## Adding a Preset View to the Favorites Bar By default, Preset Views are added to the View Manager in the Preset View section. To add a Preset View to the Favorites Bar use the `favorite()` method: ```php theme={null} 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ``` Due to the [fundamental difference](/v5/get-started/getting-started#core-concept-user-views-vs-preset-views) between User Views and Preset Views, favorited Preset Views always appear *before* a User Views in the Favorites Bar. ``` -------------------------------- ### Add Composer Authentication (Bash) Source: https://docs.advancedtables.com/v5/get-started/installation Configures Composer to use HTTP basic authentication for a private repository, typically used for licensing keys during deployment. ```bash composer config http-basic.advancedtables.privato.pub "[license-email]" "[license-key]" ``` -------------------------------- ### Set Custom Preset View Label using label() Method (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Shows an alternative way to set a custom label ('Processing orders') for a Preset View using the `label()` method, alongside the `modifyQueryUsing()` method for query modification. ```php 'processing' => PresetView::make() ->label('Processing orders') ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ``` -------------------------------- ### Configure AdvancedTablesPlugin Source: https://docs.advancedtables.com/v5/features/preset-views Shows how to customize the AdvancedTablesPlugin within the PanelProvider, including disabling preset creation or overriding the ManagedPresetView class. ```php public function panel(Panel $panel): Panel { return $panel ->plugins([ AdvancedTablesPlugin::make() ->createUsingPresetView(false) ]) } // Custom ManagedPresetView class AdvancedTablesPlugin::make() ->managedPresetView(myCustomManagedPresetView::class) ``` -------------------------------- ### Configuring Layout and Form Width for Advanced Filter Builder Source: https://docs.advancedtables.com/v5/features/advanced-filter-builder Demonstrates how to set the display layout for the Advanced Filter Builder and adjust the form width when using the 'Modal' layout. This ensures the filters are presented effectively within the UI. ```php use Archilex\AdvancedTables\Filters\AdvancedFilter; use Filament\Tables\Actions\Action; use Filament\Tables\Table; use Filament\Tables\Enums\FiltersLayout; public function table(Table $table): Table { return $table ->filters([ AdvancedFilter::make(), ]) ->filtersLayout(FiltersLayout::Modal) ->filtersFormWidth('3xl') } ``` -------------------------------- ### Configure Default Favorite Filters for Preset Views Source: https://docs.advancedtables.com/v5/features/quick-filters Sets specific filters as favorites within a Preset View configuration, allowing for quick access to commonly used filter criteria. ```php 'recentlyCreated' => PresetView::make() ->favorite() ->defaultFavoriteFilters(['created_at']) ->defaultFilters([ 'created_at' => [ 'created_from' => now()->startOfWeek()->toDateString(), 'created_until' => now()->endOfWeek()->toDateString(), ], ]) ``` -------------------------------- ### Preset View Configuration Methods Source: https://docs.advancedtables.com/v5/features/preset-views Methods to configure the behavior and management of Preset Views within the Advanced Tables plugin. ```APIDOC ## Configuration Methods ### Description Methods to manage Preset View behavior, including user management, sorting, and session persistence. ### Methods - **presetViewsManageable(bool)**: Enables or disables the ability for users to sort or modify Preset Views in the Favorites Bar. - **newPresetViewSortPosition(string)**: Configures the position ('before' or 'after') of new Preset Views relative to existing user ordering. - **persistActiveViewInSession()**: Enables persistence of the active view in the user's session. ### Request Example ```php AdvancedTablesPlugin::make() ->presetViewsManageable(false) ->newPresetViewSortPosition('after') ->persistActiveViewInSession() ``` ``` -------------------------------- ### Displaying View Types as Badges in View Manager Source: https://docs.advancedtables.com/v5/features/view-manager This method configures the View Manager to display view types as badges instead of icons. This can provide a more distinct visual representation for different view types. It does not require any arguments. ```php AdvancedTablesPlugin::make() ->viewManagerViewTypeBadges() ``` -------------------------------- ### Configure Quick Save Settings Source: https://docs.advancedtables.com/v5/features/quick-save Methods for customizing the Quick Save feature via the AdvancedTablesPlugin configuration. ```APIDOC ## Configuration: Quick Save ### Description Methods to manage the behavior and display of the Quick Save button within the Advanced Tables plugin. ### Methods - **quickSaveEnabled(bool)**: Globally enable or disable the Quick Save button. - **quickSaveInFavoritesBar(icon, position)**: Configures the icon and position of the button within the Favorites Bar. - **quickSaveInTable()**: Moves the Quick Save button to the table toolbar. - **quickSaveSlideOver(bool)**: Toggles between slide-over and modal display for the save form. - **quickSaveTriggerAction(callable)**: Customizes the appearance and behavior of the trigger button. ### Configuration Example ```php AdvancedTablesPlugin::make() ->quickSaveEnabled(true) ->quickSaveInFavoritesBar(icon: 'heroicon-o-bookmark', position: 'start') ->quickSaveSlideOver(false) ->quickSaveTriggerAction(function (Action $action) { return $action->button()->label('Save'); }) ``` ``` -------------------------------- ### Create Preset Views with Custom Queries (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Defines multiple Preset Views ('processing', 'delivered') for a table, each modifying the underlying Eloquent query to filter records based on the 'status' column. This allows for pre-defined data filtering without user interaction. ```php use Archilex\AdvancedTables\Components\PresetView; use Archilex\AdvancedTables\AdvancedTables; class ListOrders extends ListRecords { use AdvancedTables; public function getPresetViews(): array { return [ 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')), 'delivered' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'delivered')), ]; } } ``` -------------------------------- ### Customize Preset View Label and Favorite Status (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Demonstrates how to set a custom display label ('Processing orders') for a Preset View and mark it as a favorite using the `favorite()` method. The `modifyQueryUsing()` method is used to apply a 'status' filter. ```php 'processing' => PresetView::make('Processing orders') ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ``` -------------------------------- ### Configure custom tenant column in PHP Source: https://docs.advancedtables.com/v5/multi-tenancy/configuration This snippet demonstrates how to specify a custom column name for multi-tenancy support. It is used during the plugin initialization process to ensure the plugin queries the correct database column. ```php AdvancedTablesPlugin::make() ->tenantColumn('account_id') ``` -------------------------------- ### Integrate Advanced Tables v5 CSS Files Source: https://docs.advancedtables.com/v5/get-started/upgrading This code demonstrates how to integrate the necessary CSS files for Advanced Tables v5 into your Filament theme. It includes importing the core Filament theme and the plugin's specific CSS, along with source paths for theme compilation. ```css @import '../../../../vendor/filament/filament/resources/css/theme.css'; @import '../../../../vendor/archilex/filament-filter-sets/resources/css/plugin.css'; // Add @source '../../../../app/Filament'; @source '../../../../resources/views/filament'; @source '../../../../vendor/archilex/filament-filter-sets'; // Add ``` -------------------------------- ### Configure Composer Repository Source: https://docs.advancedtables.com/v5/get-started/installation Add the Advanced Tables private repository to your project's Composer configuration to enable package discovery. ```bash composer config repositories.archilex composer https://advancedtables.privato.pub/composer ``` ```json { "repositories": [ { "type": "composer", "url": "https://advancedtables.privato.pub/composer" } ] } ``` -------------------------------- ### Preset and User View Distinction Source: https://docs.advancedtables.com/v5/features/preset-views Methods to visually and functionally distinguish between Preset Views and User Views to prevent user confusion. ```APIDOC ## View Distinction Configuration ### Description Provides options to prevent confusion when users create views based on Preset Views, including disabling creation, adding dividers, or using lock icons. ### Methods - **createUsingPresetView(bool)**: Disables the creation of User Views when a Preset View is selected. - **favoritesBarDivider()**: Displays a divider line between Preset and User Views. - **presetViewLockIcon(string|null)**: Displays a lock icon next to Preset Views. - **indicator(string)**: Adds a badge to the View Summary to describe query modifications. ### Request Example ```php AdvancedTablesPlugin::make() ->createUsingPresetView(false) ->favoritesBarDivider() ->presetViewLockIcon('heroicon-o-lock-closed') // On a specific PresetView instance PresetView::make() ->indicator('Filtered by custom query') ``` ``` -------------------------------- ### Customize Multi-Sort Trigger Action (PHP) Source: https://docs.advancedtables.com/v5/features/multi-sort This code demonstrates how to customize the Multi-Sort trigger button's appearance and behavior using the `multiSortTriggerAction()` method. It allows setting an icon, tooltip, and color, similar to Filament's trigger action customization. ```php use Filament\Actions\Action; AdvancedTablesPlugin::make() ->multiSortTriggerAction(function (Action $action) { return $action ->icon('heroicon-s-chevron-up-down') ->tooltip('Sort by multiple columns') ->color('primary'); }) ``` -------------------------------- ### Toggle and reorder columns in Preset View Source: https://docs.advancedtables.com/v5/features/preset-views Configures the default visibility and order of columns using the defaultColumns method. Columns not included in the array are either hidden or moved to the end based on their toggleable status. ```php 'processing' => PresetView::make() ->defaultColumns(['id', 'status', 'customer.name', 'created_at']) ``` -------------------------------- ### Create UserViewPolicy via Artisan Source: https://docs.advancedtables.com/v5/configuration/authorization Generates a new policy class file for the UserView model using the Laravel Artisan CLI. ```bash php artisan make:policy UserViewPolicy ``` -------------------------------- ### Register Plugin in Filament Panel Source: https://docs.advancedtables.com/v5/get-started/installation Integrate the Advanced Tables plugin into your Filament panel configuration by adding it to the plugins array. ```php use Archilex\AdvancedTables\Plugin\AdvancedTablesPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ AdvancedTablesPlugin::make() ]); } ``` -------------------------------- ### Configure Tenant Column Source: https://docs.advancedtables.com/v5/multi-tenancy/configuration Configures the plugin to use a custom column name for multi-tenancy instead of the default tenant_id. ```APIDOC ## POST /configure/tenant-column ### Description Updates the configuration to reference a custom table column for multi-tenancy support. ### Method POST ### Endpoint /configure/tenant-column ### Parameters #### Request Body - **tenantColumn** (string) - Required - The name of the column to be used for multi-tenancy (e.g., 'account_id'). ### Request Example { "tenantColumn": "account_id" } ### Response #### Success Response (200) - **status** (string) - Confirmation message of the configuration update. #### Response Example { "status": "success", "message": "Tenant column updated to account_id" } ``` -------------------------------- ### Configure Authentication Guard Source: https://docs.advancedtables.com/v5/configuration/additional-configurations Sets the authentication guard for standalone Table Builder usage within the configuration file. ```php 'users' => [ 'auth_guard' => 'web', ], ``` -------------------------------- ### Configure New Preset View Sort Position Source: https://docs.advancedtables.com/v5/features/preset-views Sets the default position for newly added preset views when management is enabled. The `newPresetViewSortPosition()` method can be set to 'before' (default) or 'after' to control where new views appear relative to existing user-ordered views. ```php AdvancedTablesPlugin::make() ->newPresetViewSortPosition('after') ``` -------------------------------- ### Display Quick Save Form as Modal Source: https://docs.advancedtables.com/v5/features/quick-save Change the Quick Save form's display behavior from a slide-over to a modal. This is controlled by the `quickSaveSlideOver` method, setting it to `false` will enable modal display. ```php AdvancedTablesPlugin::make() ->quickSaveSlideOver(false) ``` -------------------------------- ### Configure Advanced Search Dropdown Order (PHP) Source: https://docs.advancedtables.com/v5/features/advanced-search Configures the Advanced Search dropdown to display columns before constraints. This is achieved by calling the `advancedSearchDropdownColumnsFirst()` method on the `AdvancedTablesPlugin` instance. ```php AdvancedTablesPlugin::make() ->advancedSearchEnabled() ->advancedSearchDropdownColumnsFirst() ``` -------------------------------- ### Displaying a Reset Link Source: https://docs.advancedtables.com/v5/features/view-manager Add a 'Reset View' link to the View Manager with `viewManagerResetView()`, which functions like clicking the 'Default View' button. ```APIDOC ## Displaying a Reset Link ### Description Includes a 'Reset View' link within the View Manager. Clicking this link resets the table to its default view configuration, similar to the 'Default View' button. ### Method `viewManagerResetView()` ### Endpoint N/A (Configuration method) ### Parameters N/A ### Request Example ```php AdvancedTablesPlugin::make() ->viewManagerResetView(); ``` ### Response N/A ``` -------------------------------- ### Set Default Table Grouping Source: https://docs.advancedtables.com/v5/features/preset-views Shows how to define a default grouping strategy for a table view using the defaultGrouping() method. ```php 'new_this_quarter' => PresetView::make() ->defaultGrouping('created_at', 'desc') ``` -------------------------------- ### Add Preset View to Favorites Bar (PHP) Source: https://docs.advancedtables.com/v5/features/preset-views Illustrates how to add a Preset View to the Favorites Bar using the `favorite()` method. This Preset View filters records where the 'status' is 'processing'. ```php 'processing' => PresetView::make() ->modifyQueryUsing(fn ($query) => $query->where('status', 'processing')) ->favorite(), ```