PHPackages                             m1davp/nova-custom-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. m1davp/nova-custom-table-card

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

m1davp/nova-custom-table-card
=============================

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

4.1.0(3y ago)0603MITVuePHP ^8.1

Since Aug 26Pushed 3y agoCompare

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

READMEChangelogDependencies (1)Versions (27)Used By (0)

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

[](#nova-custom-table-card)

Simple Nova Card for Custom Tables
----------------------------------

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

Simple card table with data of you choice.

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

[![Nova Custom Table Card](https://raw.githubusercontent.com/m1daVP/nova-custom-table-card/master/screenshot.png)](https://raw.githubusercontent.com/m1daVP/nova-custom-table-card/master/screenshot.png)

This docs are only for v. &gt; 2.\*
-----------------------------------

[](#this-docs-are-only-for-v--2)

In version 2 added: refresh (reload), possiblity to add id and classes to cells

In version 3: **REMOVED refresh**, fixed problem with multiple dashboards

Version 4: Add compatibility for Nova v. 4

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

[](#installation)

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

```
composer require m1davp/nova-custom-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 \M1daVP\CustomTableCard\CustomTableCard(
            array $header, array $data, string $title, array $viewAll
        ),
    ];
}
```

Example of use:

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

        // all the parameters are required
        new \M1daVP\CustomTableCard\CustomTableCard(
            [
                new \M1daVP\CustomTableCard\Table\Cell('Order Number'),
                // Set sortable to true in a header Cell to allow its column's sorting
                (new \M1daVP\CustomTableCard\Table\Cell('Price'))->sortable(true)->class('text-right'),
            ], // header
            [
                (new \M1daVP\CustomTableCard\Table\Row(
                    new \M1daVP\CustomTableCard\Table\Cell('2018091001'),
                    (new \M1daVP\CustomTableCard\Table\Cell('20.50'))->class('text-right')->id('price-2')
                ))->viewLink('/resources/orders/1'),
                (new \M1daVP\CustomTableCard\Table\Row(
                    new \M1daVP\CustomTableCard\Table\Cell('2018091002'),
                    (new \M1daVP\CustomTableCard\Table\Cell('201.25'))->class('text-right')->id('price-2')
                )),
            ], // data
            'Orders,' // title
            ['label' => 'View All', 'link' => '/resources/orders'], // View All
        ),
    ];
}
```

or:

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

        // all the parameters are required except title
        (new \M1daVP\CustomTableCard\CustomTableCard)
            ->header([
                new \M1daVP\CustomTableCard\Table\Cell('Order Number'),
                // Set sortable to true in a header Cell to allow its column's sorting
                (new \M1daVP\CustomTableCard\Table\Cell('Price'))->sortable(true)->class('text-right'),
            ])
            ->data([
                (new \M1daVP\CustomTableCard\Table\Row(
                    new \M1daVP\CustomTableCard\Table\Cell('2018091001'),
                    (new \M1daVP\CustomTableCard\Table\Cell('20.50'))->class('text-right')->id('price-2')
                ))->viewLink('/resources/orders/1'),
                (new \M1daVP\CustomTableCard\Table\Row(
                    new \M1daVP\CustomTableCard\Table\Cell('2018091002'),
                    (new \M1daVP\CustomTableCard\Table\Cell('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 \\M1daVP\\CustomTableCard\\CustomTableCard in Nova/Cards directory on example.

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

```
