marshmallow/resource-progress

dev-main 2024-11-20 10:50 UTC

This package is auto-updated.

Last update: 2024-11-20 10:50:51 UTC


README

use HasMetadata;
use TrackResourceProgress;

#[ResourceProgressSuite(suite: 'progress', name: 'Progress')]
#[ResourceProgressSuite(suite: 'publish', name: 'Publish', fields: ['name', 'intro'])]
class Product extends ModelsProduct implements HasMedia, Sortable
{
    // Optional if you dont provide the fields in the attribute
    public function getProgressRequiredFields(): array
    {
        return ['name', 'intro', 'description', 'supplier_id', 'product_category_id'];
    }
}
public function setPublishActions(): array
{
    return [
        \Marshmallow\ResourceProgress\Actions\FieldFilled::class,
    ];
}
artisan make:resource-progress-action MissingTranslationsAction
a make:resource-progress-suite SeoSuite

Register your suites in the model (required action)

#[ResourceProgressSuite(suite: 'progress', name: 'Progress')]
#[ResourceProgressSuite(suite: 'publish', name: 'Publish')]
#[ResourceProgressSuite(suite: 'seo', name: 'SEO')]
class Product extends ModelsProduct implements HasMedia, Sortable

Register the field (required action)

ResourceProgress::make(__('Progress')),
// Selected resources
IndexResourceProgress::make(),

// All resources
IndexResourcesProgress::make(self::class)->standalone(),
``