PHPackages                             dytechltd/custom-table - 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. dytechltd/custom-table

ActiveLibrary[Admin Panels](/categories/admin)

dytechltd/custom-table
======================

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

v0.0.4(5y ago)46.1k1[3 PRs](https://github.com/Dennis-Mwea/custom-nova-table-card/pulls)MITVuePHP &gt;=7.1.0

Since Mar 20Pushed 3y ago1 watchersCompare

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

READMEChangelog (5)DependenciesVersions (9)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, users, ...

Empty table: [![Nova Custom Empty Table Card](https://github.com/Dennis-Mwea/custom-nova-table-card/raw/master/EmptyTable.png)](https://github.com/Dennis-Mwea/custom-nova-table-card/blob/master/EmptyTable.png)

Table with data: [![Nova Custom Table Card](https://github.com/Dennis-Mwea/custom-nova-table-card/raw/master/TableWithData.png)](https://github.com/Dennis-Mwea/custom-nova-table-card/blob/master/TableWithData.png)

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

[](#installation)

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

```
composer require dytechltd/custom-table
```

You must register the card with NovaServiceProvider.

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

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

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

Example of use:

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

        // all the parameters are required
        new \Dytechltd\CustomTable\CustomTable(
            [
                new \Dytechltd\CustomTable\Table\Cell('Order Number'),
                (new \Dytechltd\CustomTable\Table\Cell('Price'))->class('text-right'),
            ], // header
            [
                (new \Dytechltd\CustomTable\Table\Row(
                    new \Dytechltd\CustomTable\Table\Cell('2018091001'),
                    (new \Dytechltd\CustomTable\Table\Cell('20.50'))->class('text-right')->id('price-2')
                ))->viewLink('/resources/orders/1'),
                (new \Dytechltd\CustomTable\Table\Row(
                    new \Dytechltd\CustomTable\Table\Cell('2018091002'),
                    (new \Dytechltd\CustomTable\Table\Cell('201.25'))->class('text-right')->id('price-2')
                )),
            ], // data
            'Orders' //title
        ),
    ];
}
```

or:

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

        // all the parameters are required except title
        (new \Dytechltd\CustomTable\CustomTableCard)
            ->header([
                new \Dytechltd\CustomTable\Table\Cell('Order Number'),
                (new \Dytechltd\CustomTable\Table\Cell('Price'))->class('text-right'),
            ])
            ->data([
                (new \Dytechltd\CustomTable\Table\Row(
                    new \Dytechltd\CustomTable\Table\Cell('2018091001'),
                    (new \Dytechltd\CustomTable\Table\Cell('20.50'))->class('text-right')->id('price-2')
                ))->viewLink('/resources/orders/1'),
                (new \Dytechltd\CustomTable\Table\Row(
                    new \Dytechltd\CustomTable\Table\Cell('2018091002'),
                    (new \Dytechltd\CustomTable\Table\Cell('201.25'))->class('text-right')->id('price-2')
                )),
            ])
            ->title('Orders')
            ->refresh(5), // If you need refresh your card data (in seconds)
    ];
}
```

or:

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

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

```
