Laravel Community Tools by Tighten
Laravel Nova icon Nova Packages
N

Resource Status

Readme

Nova Resource Status

A laravel Nova package which allows you to track the status of your Nova resource.

Installation

You can install the package via composer:

composer require digitalcloud/nova-resource-status

You must publish the migrations file:

php artisan vendor:publish --provider="DigitalCloud\NovaResourceStatus\ToolServiceProvider" --tag=migrations

Then, migrate the database table:

php artisan migrate

Optionally, you can publish the config file:

php artisan vendor:publish --provider="DigitalCloud\NovaResourceStatus\ToolServiceProvider" --tag=config

This is the contents of the file which will be published at config/nova-resource-status.php

<?php

return [
    /*
     * The class name of the status model that holds all statuses.
     * The model must be or extend `DigitalCloud\NovaResourceStatus\Models\Status`.
     */
    'status_model' => DigitalCloud\NovaResourceStatus\Models\Status::class,

    /*
     * The default name of the status attribute if not declared in model.
     */
    'status-field' => 'status'
];

Usage

You must add HasStatus trait to the resource model.

use DigitalCloud\NovaResourceStatus\HasStatus;

class YourEloquentModel extends Model
{
    use HasStatus;
    
    // use this function to indicate the status column in this model.
    // If this function not existed, then the value of `status-field`
    // form config file will be considered.
    public function statusField() {
        return 'yourStatusColumn';
    }
}

This will add database record each time the status attribute changes.

To show all status log, add the Statuses field in your nova resource:

<?php

namespace App\Nova;

use DigitalCloud\NovaResourceStatus\Fields\Statuses;
use Illuminate\Http\Request;

class YourResource extends Resource {
    
    // ...
    
    public static $model = 'YourEloquentModel'; // model must use `HasStatus` trait`
    
    public function fields(Request $request)
    {
        return [
            // ...
            // This will appear in the resource detail view.
            Statuses::make(),
            // ...
        ];
    }
    
    // ...

}

Then, in resource detail page, you can see the history of your resource status.

Images

status

Reviews

By Mark Walet on November 2, 2021

No updates from the developer. Last commit was 3 years ago. Open PR's are not being merged.

By Valeriu Vodnicear on May 5, 2021

nice for the bugs use https://github.com/DigitalCloud/nova-resource-status/pull/2

Back to Top
Added 7 years ago
Last updated 6 Years Ago
Version v1.4
Composer
digitalcloud/nova-resource-status
GitHub stars 3
Packagist downloads 8,097

Favorites

15 users favorited

Rating

2.30
(out of 5)
★★★★★
★★★★
★★★
★★
3 ratings

Contributors

Brought to you by Tighten

Issues/Feature Requests Stats Package Ideas