PHPackages                             joerithegreat/nova-table-card - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. joerithegreat/nova-table-card

ActiveLibrary[Admin Panels](/categories/admin)

joerithegreat/nova-table-card
=============================

Nova table card. Show your latest data (orders, posts,...) as card or data you prefer.

1.1.0(1y ago)109.3k—3%2MITVuePHP ^8.1

Since Nov 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/whitespacecode/nova-table-card)[ Packagist](https://packagist.org/packages/joerithegreat/nova-table-card)[ RSS](/packages/joerithegreat-nova-table-card/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

Nova Table Card
===============

[](#nova-table-card)

Simple Nova Card for Displaying Tables
--------------------------------------

[](#simple-nova-card-for-displaying-tables)

**NOTE**: This has been forked from [m-a-k-o/nova-custom-table-card](https://github.com/m-a-k-o/nova-custom-table-card), see [issue #8](https://github.com/m-a-k-o/nova-custom-table-card/issues/8)

Simple card table with data of you choice.

It can be useful as latest order list or latest posts, ...

[![Nova Table Card](https://github.com/Whitespacecode/nova-table-card/raw/master/example.png)](https://github.com/Whitespacecode/nova-table-card/blob/master/example.png)

Requirements
------------

[](#requirements)

- `php: >=8.1`
- `laravel/nova: ^4.0`

Installation
------------

[](#installation)

You can install the package in to a Laravel app that uses [Nova](https://nova.laravel.com) via composer:

```
composer require whitespacecode/nova-table-card
```

You must register the card with NovaServiceProvider.

```
// in app/Providers/NovaServiceProvder.php

// ...
public function cards()
{
    return [
        // ...

        // all the parameters are required excelpt title
        new \Whitespacecode\TableCard\TableCard(
            array $header, array $data, string $title, array $viewAll
        ),
    ];
}
```

Example of use:

```
use Whitespacecode\TableCard\TableCard;
use Whitespacecode\TableCard\Table\Cell;
use Whitespacecode\TableCard\Table\Row;

// ...
public function cards()
{
    return [
        // ...

        // all the parameters are required except title and/or viewLink
        (new TableCard)
            ->header([
                Cell::make('Order Number'),
                // Set sortable to true in a header Cell to allow its column's sorting
                (Cell::make('Price'))->sortable(true)->class('text-right'),
            ])
            ->data([
                (Row::make(
                    Cell::make('2018091001'),
                    (Cell::make('20.50'))->class('text-right')->id('price-2')
                ))->viewLink('/resources/orders/1'), //Add viewLink to show clickable eye
                (Row::make(
                    Cell::make('2018091002'),
                    (Cell::make('201.25'))->class('text-right')->id('price-2')
                )),
            ])
            ->title('Orders')
            ->viewAll(['label' => 'View All', 'link' => '/resources/orders']),
    ];
}
```

or:

You can create your own class which will extend \\Whitespacecode\\TableCard\\TableCard in Nova/Cards directory on example.

In this separate class you are able to fetch data from models in nice clean way.

```
