PHP code example of digital-creative / column-toggler

1. Go to this page and download the library: Download digital-creative/column-toggler library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digital-creative / column-toggler example snippets


namespace App\Nova\Resources;

use DigitalCreative\ColumnToggler\ColumnTogglerTrait;
use Laravel\Nova\Resource as NovaResource;

abstract class Resource extends NovaResource
{
    use ColumnTogglerTrait;
}

public function fieldsForIndex(NovaRequest $request): array
{
    return [
        ID::make()->sortable(),

        Text::make('First Name', 'first_name')
            ->sortable(),

        Text::make('Last Name', 'last_name')
            ->sortable(),

        Text::make('Favorite Color', 'favorite_color')
            ->sortable()
            ->hideByDefault(),

        Boolean::make('Active', 'active')
            ->hideByDefault(),
    ];
}

// config/nova.php

'vendors' => [
    'column_toggler' => [
        'enable_sorting' => false,
    ]
]