A Laravel Nova field for displaying a status icon, with optional tooltip, on index and detail pages of your models. This package utilizes several icons from the Heroicons UI icon pack (from designer Steve Schroger), which is also used in Laravel Nova.
You can install the package using composer:
composer require wesselperik/nova-status-field
Next up, add the field to your desired Nova model. See the example below:
// for example, in app/Nova/Post.php
use WesselPerik\StatusField\StatusField;
// ...
public function fields(Request $request) {
return [
// ...
StatusField::make('Published')
->values([
'inactive' => $this->published == 0 || $this->published_at == null,
'pending' => $this->published == 1 && $this->published_at => now(),
'active' => $this->published == 1 && $this->published_at < now()
])
->tooltip("Super awesome tooltip!")
->exceptOnForms()
];
}
Available values (with matching icons) are:
- inactive
- active
- pending
- info
- warning
- help
The MIT License (MIT). Please see the license file for more information.