PHP code example of comodolab / nova-help

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

    

comodolab / nova-help example snippets


use Comodolab\Nova\Fields\Help\Help;

public function fields(Request $request)
{
    return [
        Help::make('Help title', 'Help message!'),
    ];
}

Help::make('title', 'message'); // Default help message
Help::success('title', 'message');
Help::info('title', 'message');
Help::warning('title', 'message');
Help::danger('title', 'message');

// There's also a special template for headings
Help::header('title', 'subtitle');

// If you prefer you can call the non static type method
Help::make('title', 'message')->type('warning'); 

Help::make('Only title');
Help::make()->message('Only message');

Help::make()->message(function () {
    return "{$this->name} is awesome!";
});

Help::make('Title')->icon('help'); // the default one
Help::make('Title')->icon('info');
Help::make('Title')->icon('warning');
Help::make('Title')->icon('danger');
// Load a custom one
Help::make('Love you')
    ->message('Yes, I love you!')
    ->icon('<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m10 3.22-.61-.6a5.5 5.5 0 0 0 -7.78 7.77l8.39 8.39 8.39-8.4a5.5 5.5 0 0 0 -7.78-7.77z"/></svg>');
// or show no icon at all
Help::make('Sad')->withoutIcon();

Help::make('Title', 'Message with <a href="#">link</a>')->displayAsHtml();

// Remove annoing padding in detail screen, also the default behaviour for the heading template 
Help::make('Negative margin')->showFullWidthOnDetail();

// Show a side label instead of the title on the top
Help::make('Look I\'m on the side')
    ->message('I\'m not...')
    ->withSideLabel();

// Collapsible field
Help::info('Click here to toggle', 'Lorem ipsum dolor sit amet...')
    ->collapsible();

/**
 * By default help messages aren't shown on index,
 * when enabled they are shown as an hoverable 
 * icon showing a plain (no html) tooltip.
 */
Help::make('Column title')
    ->message('Message with <a href="#">link</a>') // The link code will be stripped out on index
    ->alsoOnIndex();
    
// Field icons can be shown conditionally on index
Help::make()->message(function () {
    return $this->name?"{$this->name} is awesome!":null;
})->onlyOnIndex();