PHP code example of gabrielesbaiz / nova-field-indicator

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

    

gabrielesbaiz / nova-field-indicator example snippets


use Gabrielesbaiz\NovaFieldIndicator\NovaFieldIndicator;

NovaFieldIndicator::make('Status'),

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

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

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

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

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

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

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

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

NovaFieldIndicator::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)',
    ])

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