dotburo/nova-log-level-field

Laravel Nova field for log and error level badges.

Downloads

11

Stars

0

Version

1.1.0

Nova Log Level Field

Packagist Downloads

A Laravel Nova field to display an error/log level badge on index and detail views of models.

Features

  • Follows the PSR-3: Logger Interface log levels
  • Big or small badge
  • Customizable badge colors
  • Super tiny, no css or js files

Installation

composer require dotburo/nova-log-level-field

Usage

The package expects the value of the field to be one of PSR-3 log level: emergency, alert, critical, error, warning, notice, info or debug.

// for example, in app/Nova/Post.php

use Dotburo\NovaLogLevel\LogLevelField;
use Psr\Log\LogLevel;

// ...

public function fields(Request $request) {
    return [
        LogLevelField::make('Level')
            // Optional, show a small badge
            ->small()
            // Optional, override one or more default colors
            ->colors([
                LogLevel::EMERGENCY => '#000000',
            ])
    ];
}

License

The MIT License (MIT). Please see the license file for more information.

dotburo

Author

dotburo