PHP code example of musa11971 / nova-status-card

1. Go to this page and download the library: Download musa11971/nova-status-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/ */

    

musa11971 / nova-status-card example snippets


class NovaServiceProvider extends NovaApplicationServiceProvider
{
    /**
     * Get the cards that should be displayed on the default Nova dashboard.
     *
     * @return array
     */
    protected function cards()
    {
        return [
            NovaStatusCard::make()
                ->title('Server Status')
                ->items([
                    NovaStatusItem::make('Database Usage')
                        ->percentage()
                        ->value(function() {
                            // Calculate value...
                            return 55.43;
                        }),
                        
                    NovaStatusItem::make('Redis Server')
                        ->statusIndicator()
                        ->value(function($value) {
                            // Perform check...
                            return $value->ok();
                        })
                ])
        ];
    }
}

NovaStatusItem::make('Department Condition')
    ->string()
    ->value(Department::first()->condition)

NovaStatusItem::make('Database Usage')
    ->percentage()
    ->value(function() {
        // Calculate value...
        return 55.43;
    })

NovaStatusItem::make('MySQL Server Status')
    ->statusIndicator()
    ->value(function($value) {
        return $value->ok();
        // or:
        // $value->danger();
        // $value->risky();
        // $value->unknown();
    })

NovaStatusItem::make('MySQL Server Status')
    ->statusIndicator()
    ->value(function($value) {
        return $value->risky()->hint('Server responded slowly.');
    })