PHP code example of inspheric / nova-indicator-field

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

    

inspheric / nova-indicator-field example snippets


use Inspheric\Fields\Indicator;

Indicator::make('Status'),

Indicator::make('Status')
    ->labels([
        'banned' => 'Banned',
        'active' => 'Active',
        'invited' => 'Invited',
        'inactive' => 'Inactive',
    ])

Indicator::make('Status')
    ->withoutLabels()

Indicator::make('Status')
    ->unknown('Unknown')

Indicator::make('Status')
    ->shouldHide('active')

Indicator::make('Status')
    ->shouldHide(['invited', 'requested'])

Indicator::make('Status')
    ->shouldHide(function($value) {
        return $value == 'inactive';
    })

Indicator::make('Status')
    ->shouldHideIfNo()

Indicator::make('Status')
    ->colors([
        'banned' => 'red',
        'active' => 'green',
        'invited' => 'blue',
        'inactive' => 'grey',
    ])

Indicator::make('Status')
    ->colors([
        '...' => '#ff0000',
        '...' => 'rgb(0, 255, 0)',
        '...' => 'rgba(0, 0, 0, 0.5)',
        '...' => 'hsl(120, 100%, 50%)',
        '...' => 'hsla(120, 100%, 50%, 0.5)',
        '...' => 'var(--success)',
    ])

Indicator::make('Status')
    ->colors([
        'yourstatus' => 'yourcolourname',
    ])