PHP code example of dillingham / nova-list-card

1. Go to this page and download the library: Download dillingham/nova-list-card library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dillingham / nova-list-card example snippets




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();
    }

->width('3/5')

->heading('Top Bloggers')

->subtitle(),

->subtitle('city'),

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

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

->value('city'),

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

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

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

->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(3)

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

->viewAll()

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

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

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

    return $query;
}

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

->zebra()

->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'),
bash
php artisan nova:list-card RecentUsers