All Projects → dcasia → Nova Mega Filter

dcasia / Nova Mega Filter

Licence: mit
Allows you to control the columns and filters shown on any Nova resource index

Projects that are alternatives of or similar to Nova Mega Filter

Nova Impersonate
A Laravel Nova field allows you to authenticate as your users.
Stars: ✭ 182 (+271.43%)
Mutual labels:  laravel, nova
Nova Tags Field
A tags field to use in your Nova apps
Stars: ✭ 204 (+316.33%)
Mutual labels:  laravel, nova
Nova Filemanager
A Filemanager tool for Laravel Nova
Stars: ✭ 189 (+285.71%)
Mutual labels:  laravel, nova
Nova Cashier Manager
Managing Stripe subscriptions inside the incredible Laravel Nova admin panel.
Stars: ✭ 150 (+206.12%)
Mutual labels:  laravel, nova
Laravel Nova Lang
🌌 Language files for Laravel Nova translated into 40+ languages. Feel free to submit your language or update an existing one!
Stars: ✭ 275 (+461.22%)
Mutual labels:  laravel, nova
Laravel Nova Localizations
🌎 Localization files for Laravel Nova
Stars: ✭ 161 (+228.57%)
Mutual labels:  laravel, nova
Nova Time Field
Laravel Nova Time Field
Stars: ✭ 45 (-8.16%)
Mutual labels:  laravel, nova
Nova Repeatable Fields
A Laravel Nova field for configuring repeatable sets of fields
Stars: ✭ 126 (+157.14%)
Mutual labels:  laravel, nova
Nova Tabs
Laravel Nova Tabs Package
Stars: ✭ 265 (+440.82%)
Mutual labels:  laravel, nova
Nova Backup Tool
A Laravel Nova tool to backup your app
Stars: ✭ 260 (+430.61%)
Mutual labels:  laravel, nova
Repository
🖖Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any kind of filters.
Stars: ✭ 134 (+173.47%)
Mutual labels:  laravel, filters
Scout Extended
Scout Extended: The Full Power of Algolia in Laravel
Stars: ✭ 330 (+573.47%)
Mutual labels:  laravel, nova
Nova Slug Field
Slug field for Laravel Nova
Stars: ✭ 131 (+167.35%)
Mutual labels:  laravel, nova
Laravel Nova Nested Form
This package allows you to include your nested relationships' forms into a parent form.
Stars: ✭ 169 (+244.9%)
Mutual labels:  laravel, nova
Nova Settings Tool
Laravel Nova tool to view and edit application settings.
Stars: ✭ 131 (+167.35%)
Mutual labels:  laravel, nova
Skeleton Nova Tool
A skeleton repository for Spatie's Nova Packages
Stars: ✭ 191 (+289.8%)
Mutual labels:  laravel, nova
Nova Tail Tool
A Laravel Nova tool to display the application log
Stars: ✭ 110 (+124.49%)
Mutual labels:  laravel, nova
Nova Translatable
Making Nova fields translatable
Stars: ✭ 119 (+142.86%)
Mutual labels:  laravel, nova
Laravel Nova Excel
🚀 Supercharged Excel exports for Laravel Nova Resources
Stars: ✭ 259 (+428.57%)
Mutual labels:  laravel, nova
Nova Permission
A Laravel Nova tool for Spatie's laravel-permission library
Stars: ✭ 294 (+500%)
Mutual labels:  laravel, nova

Nova Mega Filter

Latest Version on Packagist Total Downloads License

This package allows you to control the columns and filters shown on your nova resources.

Installation

You can install the package via composer:

composer require digital-creative/nova-mega-filter

Basic Usage

Basic demo showing the power of this field:

use DigitalCreative\MegaFilter\MegaFilter;
use DigitalCreative\MegaFilter\HasMegaFilterTrait;
use DigitalCreative\MegaFilter\Column;

class ExampleNovaResource extends Resource {

    use HasMegaFilterTrait; // Important!!

    public function cards(Request $request)
    {
        return [
            MegaFilter::make([
                'filters' => [
                    new DateOfBirthFilter(),
                    new UserTypeFilter()
                ],
                'columns' => [
                    Column::make('Customer Name', 'name')->addFilter(new ActiveFilter()),
                    Column::make('Assets'),
                    Column::make('Payments')
                ]
            ])
        ];
    }

}

Columns

Columns reflects every column that is normally shown on your table resource, however you are free to give your user the ability to toggle it on/off:

Columns in Action

use DigitalCreative\MegaFilter\Column;
use DigitalCreative\MegaFilter\HasMegaFilterTrait;
use DigitalCreative\MegaFilter\MegaFilter;

MegaFilter::make([
    'columns' => [
        Column::make($label),
        Column::make($label, $attribute),
        Column::make($label, $attribute, $filters),
        new Column($label, $attribute, $filters),
    ],
])

You can add additional filters that only appears when the desired column is enabled:

MegaFilter::make([
    'columns' => [
        Column::make('Gender')->addFilter(new GenderFilter())
    ],
])

Columns in Action

If you want to have filters that are always shown, use the 'filters' option bellow

You can also define columns that can not be toggled by the user and will be always present on the table resource:

MegaFilter::make([
    'columns' => [
        Column::make('Name')->permanent()
    ],
])

When using ->permanent() every filter that the column may define will be also present

Other column methods include the ability to have a column default checked

MegaFilter::make([
    'columns' => [
        Column::make('Name')->checked() // Checked by default
    ],
])

Filters

The filters key accepts an array of any instance of the default Nova filter class or third party.

MegaFilter::make([
    'filters' => [
       new BirthdayFilter(),
       new UserTypeFilter(),
       new GenderFilter(),
    ],
])

Actions

Actions will use the same Nova action mechanism

MegaFilter::make([
    'actions' => [
       new ExportClientAsExcell(),
    ],
])

Columns in Action

If you have multiple actions defined, a dropdown will be shown:

Columns in Action

The columns selected will also be given to your action, you can access them directly from the request:

public function handle(ActionFields $fields, Collection $models)
{

    $columns = json_decode(request()->input('columns'));

    dd($columns);

}

Settings

The settings key is optional as it comes with some good defaults, but feel free to override it to suit your needs.

MegaFilter::make([
    'settings' => [

        /**
         * Tailwind width classes: w-full w-1/2 w-1/3 w-1/4 etc.
         */
        'columnsWidth' => 'w-1/4',
        'filtersWidth' => 'w-1/2',
        
        /**
         * The default state of the main toggle buttons
         */
        'columnsActive' => false,
        'filtersActive' => true,
        'actionsActive' => true,
        
        /**
         * Labels
         */
        'headerLabel' => 'Menu',
        'columnsLabel' => 'Columns',
        'filtersLabel' => 'Filters',
        'actionsLabel' => 'Actions',
        'columnsSectionTitle' => 'Additional Columns',
        'filtersSectionTitle' => 'Filters',
        'actionsSectionTitle' => 'Actions',
        'columnsResetLinkTitle' => 'Reset Columns',
        'filtersResetLinkTitle' => 'Reset Filters',

    ],
])

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].