PHP code example of jankapusta / nova-color-multi-status-field

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

    

jankapusta / nova-color-multi-status-field example snippets


$table->json('guests_per_week');

class Hotel extends Model {
    protected $casts = [
        'guests_per_week' => 'array',
    ];
    // ....
}

Hotel::create([
    'guests_per_week' => [
      'Feb 10' => 5,
      'Feb 17' => 1,
      'Feb 24' => 12,
      'Mar 3' => 4,
      'Mar 10' => 0,
      'Mar 17' => 8,
      'Mar 24' => 14,
      'Mar 31' => 2,
      'Apr 7' => 9,
    ],
]);


ColorMultiStatus::make('Events per week', 'guests_per_week')
   ->colorMap([
            0 => 'white',
            2 => 'lightgrey',
            5 => '#d3dc83',
            8 => '#a7c742',
            13 => '#7dbd41',
            34 => '#6cda05',
        ])
// optional configuration
  ->iconSize(5) // in pixels - default is 4
  ->iconSpacing(2)   // in pixels - default is 1
  ->showTooltips(false) // to hide tooltips 
  ->width(80), // in pixels