Skip to main content
Starting in v3, the User Views Resource is a Filament table resource primarily for admins to be able to manage the User Views of all their users. It is also where admins can approve or reject User Views with the approval system.
Important: You will need to set up a policy to limit access to the User Views Resource. Without a policy, any user will be able to rename, update, or delete any User View. See the policy section for more information.

Easily toggling a views public, or global setting

The icons in the rows are actionable and can be clicked to quickly toggle the setting.

User Views Resource configurations

Advanced Tables offers multiple ways to customize the User Views Resource. Unless specified otherwise, these options can be configured directly on the AdvancedTablesPlugin object inside your PanelProvider.

Disabling the User Views Resource

Advanced Tables enables the User Views Resource by default. If you are not using User Views, you may disable this by passing false to the resourceEnabled() method:
AdvancedTablesPlugin::make()
    ->resourceEnabled(false)
If you wish to just limit access to the User Views Resource, you should create a policy.

Customizing the labels

You may customize the model label, plural model label, and navigation label in the language file.

Customizing the navigation icon

You may customize the navigation icon by passing a heroicon to the resourceNavigationIcon() method:
AdvancedTablesPlugin::make()
    ->resourceNavigationIcon('heroicon-o-star')

Customizing the navigation group

You may customize the navigation group by passing a string to the resourceNavigationGroup() method:
AdvancedTablesPlugin::make()
    ->resourceNavigationGroup('Settings')

Customizing the navigation sort order

You may customize the navigation sort order by passing an int to the resourceNavigationSort() method:
AdvancedTablesPlugin::make()
    ->resourceNavigationSort(1)

Disabling the Navigation Badge

By default, Advanced Tables shows a badge in the navigation of the number of unapproved views. You may disable this by passing false to the resourceNavigationBadge() method:
AdvancedTablesPlugin::make()
    ->resourceNavigationBadge(false)

Disabling loading all users in the user select filter

By default, when filtering users in the User Views Resource all users will be loaded. This is fine for smaller applications with a handful of users, but if you application has hundreds or thousands of users, you may disable loading all users by passing false to the resourceLoadAllUsers method:
AdvancedTablesPlugin::make()
    ->resourceLoadAllUsers(false)

Using multiple panels

When using multiple panels the User Views Resource by default will only show the User Views associated with the current panel’s resources. However, since the UserViewResource::class is part of the plugin, if you create views on the User View Resource then those views will appear in every panel’s User Views Resource. Sometimes, this maybe desired. For example, if you create an “Approved” view on the User View Resource, you may want that view to appear in the User Views Resource of every panel. However, if you prefer each User Views Resource to be independent, you can follow the steps below:
Note: This will only affect future views created for the User Views Resource. It will not update views you previously created for your User Views Resource.
  1. Copy archilex/filament-filter-sets/src/Resources/UserViewResource.php and archilex/filament-filter-sets/src/Resources/UserViewResource/Pages/ManageUserViews.php files to your panels directory:
    +-- Filament
    │   +-- SecondaryPanel
    │   │   +-- Resources
    │   │   │   +-- UserViewResource.php
    │   │   │   +-- UserViewResource
    │   │   │   │   +-- Pages
    │   │   │   │   │   +-- ManageUserViews.php
    
    Note: While you can extend the plugin’s UserViewResource for each panel, it is also possible to use the plugin’s UserViewResource for your main panel and only extend the resource for your secondary panels.
  2. Extend UserViewResource.php:
    namespace App\Filament\SecondaryPanel\Resources;
    
    use App\Filament\SecondaryPanel\Resources\UserViewResource\Pages\ManageUserViews;
    use Archilex\AdvancedTables\Resources\UserViewResource as Resource;
    
    class UserViewResource extends Resource
    {
        public static function getPages(): array
        {
            return [
                'index' => ManageUserViews::route('/'),
            ];
        }
    }
    
  3. Update ManageUserViews.php
    namespace App\Filament\SecondaryPanel\Resources\UserViewResource\Pages;
    
    use App\Filament\SecondaryPanel\Resources\UserViewResource;
    use Archilex\AdvancedTables\AdvancedTables;
    use Filament\Resources\Pages\ManageRecords;
    
    class ManageUserViews extends ManageRecords
    {
        use AdvancedTables;
    
        protected static string $resource = UserViewResource::class;
    }
    
Now, when you create a view inside that panel’s User Views Resource it will only appear in that panels’ User Views Resource.

Showing user views from multiple panels

As mentioned, by default the User Views Resource will only show the User Views that are associated to that panel. However, if you would like to include views from other panels you can do that by passing an array of panel ids to the ->resourcePanels() method.
AdvancedTablesPlugin::make()
    ->resourcePanels(['admin', 'secondaryPanel'])
Note: The open action will only be displayed for the current panel’s user views.