Skip to content

Provides an easy way to append extra data to each row of your resource tables.

License

Notifications You must be signed in to change notification settings

operativeit/expandable-table-row

 
 

Repository files navigation

Expandable Table Row

Latest Version on Packagist Total Downloads License

Expandable Table Row in Action

Provides an easy way to append extra data to each row of your resource tables.

Installation

You can install the package via composer:

composer require digital-creative/expandable-table-row

Basic Usage

To use the new functionality, all you need to do is add the ->expandableRowData() method to your field definition and return any class that extends Nova Field. For instance, you can create multiple lines by returning the Stack field.

class UserResource extends Resource
{
    public function fields(NovaRequest $request): array
    {
        return [
            //...
            Text::make('First Name')->expandableRowData(function () {
                return Stack::make('_', [
                    Line::make(null)->displayUsing(fn() => 'Name')->asSubTitle(),
                    Text::make('Full Name', fn(User $user) => sprintf('%s %s',$user->first_name, $user->last_name))->copyable(),
                    Text::make('Email')->copyable(),
                ]);
            }),
    
            Text::make('Last Name')->expandableRowData(function () {
                return Stack::make('_', [
                    Line::make(null)->displayUsing(fn() => 'Address')->asSubTitle(),
                    Text::make('Country'),
                    Text::make('Address', fn(User $user) => sprintf(
                        '%s, %s, %s - %s', $user->city, $user->state, $user->address, $user->zipcode
                    ))->copyable(),
                ]);
            }),
            //...          
        ];
    }
}

⭐️ Show Your Support

Please give a ⭐️ if this project helped you!

Other Packages You Might Like

License

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

About

Provides an easy way to append extra data to each row of your resource tables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 44.5%
  • Vue 38.5%
  • PHP 16.5%
  • CSS 0.5%