Plugin/Module/Package... Code - Unification of statuses for further use in their packages.
composer require mr-vaco/nova-statuses-manager
php artisan vendor:publish --tag=mr_vaco__statuses
php artisan migrate
-
StatusClass::LIST('this_code_from_list')
- Getting a list of statuses by "code" sheet parameter - by default: full / base / short -
StatusClass::DEFAULT_ID()
- object - get the first by ID status
StatusClass::DEFAULT_ID()->id
StatusClass::DEFAULT_ID()->name
StatusClass::DEFAULT_ID()->color
StatusClass::ACTIVE()
- object - get status "active" (default)
StatusClass::ACTIVE()->id
StatusClass::ACTIVE()->name
StatusClass::ACTIVE()->color
StatusClass::DISABLED()
- object - get "disabled" status (default)
StatusClass::DISABLED()->id
StatusClass::DISABLED()->name
StatusClass::DISABLED()->color
StatusClass::DRAFT()
- object - get "draft" status (default)
StatusClass::DRAFT()->id
StatusClass::DRAFT()->name
StatusClass::DRAFT()->color
StatusClass::BY_ID($id)
- object - get status by ID
StatusClass::BY_ID($id)->name
StatusClass::BY_ID($id)->color
use MrVaco\NovaStatusesManager\Classes\StatusClass;
use MrVaco\NovaStatusesManager\Fields\Status;
public function fields(NovaRequest $request): array
{
return [
Status::make(__('Status'), 'status')
->options(StatusClass::LIST('short'))
->default(StatusClass::ACTIVE()->id),
];
}