PHPackages                             webard/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. webard/nova-table-card

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

webard/nova-table-card
======================

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

v1.1.0(1y ago)11.8k↓100%MITVuePHP ^8.1

Since Sep 24Pushed 1y agoCompare

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

READMEChangelogDependencies (2)Versions (3)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 [whitespacecode/nova-table-card](https://github.com/whitespacecode/nova-table-card), see [PR #2](https://github.com/whitespacecode/nova-table-card/pull/2). This fork will be deleted from Packagist once the PR is merged.

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 webard/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.

```
