All Projects → dillingham → nova-list-card

dillingham / nova-list-card

Licence: MIT license
Add a variety of resource lists to Nova dashboards

Programming Languages

PHP
23972 projects - #3 most used programming language
Vue
7211 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nova-list-card

nova-qrcode-field
A Laravel Nova field to generate QR Code
Stars: ✭ 28 (-28.21%)
Mutual labels:  laravel-nova
nova-url-field
A URL input and link field for Laravel Nova
Stars: ✭ 96 (+146.15%)
Mutual labels:  laravel-nova
nova-hidden-field
A Laravel Nova Hidden field.
Stars: ✭ 32 (-17.95%)
Mutual labels:  laravel-nova
nova-system-resources
Display the system usage in Laravel-Nova
Stars: ✭ 30 (-23.08%)
Mutual labels:  laravel-nova
nova-horizon-stats
Nova cards for Laravel applications that use Laravel Horizon
Stars: ✭ 31 (-20.51%)
Mutual labels:  laravel-nova
nova-grouped-field
Combine multiple Nova fields as one field output
Stars: ✭ 43 (+10.26%)
Mutual labels:  laravel-nova
nova-table-field
Table field for Laravel Nova
Stars: ✭ 29 (-25.64%)
Mutual labels:  laravel-nova
nova-rating-field
A Star rating field to use in your Laravel Nova apps.
Stars: ✭ 42 (+7.69%)
Mutual labels:  laravel-nova
select-auto-complete
An auto-completing Laravel Nova search field
Stars: ✭ 34 (-12.82%)
Mutual labels:  laravel-nova
nova-settings
A tool for editing settings on your project using akaunting/setting package on Laravel Nova
Stars: ✭ 18 (-53.85%)
Mutual labels:  laravel-nova
nova-sluggable
Slug field for Laravel Nova
Stars: ✭ 40 (+2.56%)
Mutual labels:  laravel-nova
nova-html
This field allows you display custom HTML in Laravel Nova, be it a link, an image or any other piece of proper html.
Stars: ✭ 13 (-66.67%)
Mutual labels:  laravel-nova
nova-translatable
Nova Field for spatie/laravel-translatable package.
Stars: ✭ 84 (+115.38%)
Mutual labels:  laravel-nova
nova-blogify-tool
Create a simple blog in a few seconds. Powered by Laravel Nova.
Stars: ✭ 20 (-48.72%)
Mutual labels:  laravel-nova
Lang
List of 78 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.
Stars: ✭ 6,285 (+16015.38%)
Mutual labels:  laravel-nova
nova-dynamic-field
Dynamic field for Laravel Nova
Stars: ✭ 18 (-53.85%)
Mutual labels:  laravel-nova
nova-inspire
The best way to connect with your customers is by reaching out and inspiring them. ~ Me
Stars: ✭ 14 (-64.1%)
Mutual labels:  laravel-nova
nova-gridder
Customize Nova Resource Details using Tailwind Grid System and more
Stars: ✭ 18 (-53.85%)
Mutual labels:  laravel-nova
nova-errors
Display all form errors in a modal at the top of the page.
Stars: ✭ 16 (-58.97%)
Mutual labels:  laravel-nova
laravel-nova-visual-composer
Visual Composer for Laravel Nova
Stars: ✭ 15 (-61.54%)
Mutual labels:  laravel-nova

Nova List Card

Latest Version on Github Total Downloads Twitter Follow

Add a variety of lists to your dashboard

nova-list-card

Install

composer require dillingham/nova-list-card

Basic Usage

php artisan nova:list-card RecentUsers
<?php

namespace App\Nova\Metrics;

use App\Nova\User;
use NovaListCard\ListCard;

class RecentUsers extends ListCard
{
    /**
     * Setup the card options
     */
    public function __construct()
    {
        $this->resource(User::class)
            ->heading('Recent Users')
            ->orderBy('created_at', 'desc')
            ->timestamp()
            ->viewAll();
    }

View more examples

Possible Scenarios

  • Latest resource / oldest resource
  • Upcoming / past due resources
  • Top resource by relationship count
  • Top resource by relationship's column sum

Card Width

Set the card's width, default 1/3

->width('3/5')

Card Heading

->heading('Top Bloggers')

Resource Subtitle

Display resource subtitle beneath the title

->subtitle(),

or display resource proporties beneath the title

->subtitle('city'),

Timestamps

Adds timestamp beneath resource title

Optionally can add as a side value, see below.

Defaults: created_at & moment.js format: MM/DD/YYYY:

->timestamp(),
->timestamp('due_at'),
->timestamp('completed_at', 'MM/DD'),

Relative timestamps: 5 days ago | in 5 days

->timestamp('completed_at', 'relative'),

Side Values

Display resource values on the right side

->value('city'),

Aggregated Count

Add counts of relationships:

->resource(Category::class)
->withCount('posts')
->value('category_posts'),

Aggregated Sum

Add sum of relationship's column:

->resource(User::class)
->withSum('orders', 'total')
->value('orders_sum'),

Value formatting

You can change the value output using numeral.js

-value('orders_sum') // 55200
-value('orders_sum', '0.0a') // 55.2k
-value('orders_sum', '($ 0.00 a)') // $55.2k

Value Timestamp: add third parameter for moment.js formats

->value('created_at') // 2019-04-27 00:00:00
->value('created_at', 'MM/DD', 'timestamp') // 04/27
->value('created_at', 'relative', 'timestamp') // 5 days ago

Limit

Set the number of items to display, default: 5:

->limit(3)

OrderBy

Set the order of the resources:

->orderBy('scheduled_at', 'desc')

Show View All Link

You can link to the resource's index

->viewAll()

Or to a lens attached to the resource

->viewAllLens('most-popular-users')

Footer Link

You can link to a urL instead of using viewAll:

->footerLink('Google', 'https://google.com')

Scoped Resource

Check the card's uri key within IndexQuery:

public static function indexQuery($request, $query)
{
    if($request->input('nova-list-card') == 'upcoming-tasks') {
        $query->whereNull('completed_at');
    }

    return $query;
}

CSS Classes

Customize styles easily if you have your own theme.css

.nova-list-card {}
.nova-list-card-heading {}
.nova-list-card-body {}
.nova-list-card-item {}
.nova-list-card-title {}
.nova-list-card-subtitle {}
.nova-list-card-timestamp {}
.nova-list-card-value {}
.nova-list-card-footer-link {}

Also includes resource specific classes etc

.nova-list-card.users.most-tasks

Also can target specific rows

.nova-list-card-item-1 {}
.nova-list-card-item-2 {}
.nova-list-card-item-3 {}

The uri key is added to the card

#upcoming-tasks {}

You can also add classes manually

->classes('font-bold text-red some-custom-class')

You can also add alternate row formatting

->zebra()

Examples

nova-list-card

->resource(Contact::class)
->heading('Recent Contacts')
->subtitle('email')
->timestamp()
->limit(3)
->viewAll(),
->resource(Contact::class)
->heading('Contacts: Most tasks', 'Tasks')
->orderBy('tasks_count', 'desc')
->subtitle('email')
->value('tasks_count')
->withCount('tasks')
->zebra()
->viewAll(),
->resource(Contact::class)
->heading('Top Opportunities', 'Estimates')
->withSum('opportunities', 'estimate')
->value('opportunities_sum', '0.0a')
->viewAllLens('top-opportunities')
->orderBy('opportunities_sum', 'desc'),

Methods

Method Description
resource() declare the resource
heading() add a title to card
subtitle() display subtitle value
timestamp() display & format timestamp
value() display right side value
withCount() aggregate count value
withSum() aggregate sum value
orderBy() set the resource order
limit() set number of resources
viewAll() enable view all link
viewAllLens() enable lens view all
footerLink() add a static footer link
zebra() add alternate row color
id() unique id for card's requests
classes() add css classes to card

Author

Hi 👋, Im Brian Dillingham, creator of this Nova package and others

Hope you find it useful. Feel free to reach out with feedback.

Follow me on twitter: @im_brian_d

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].