35 lines
933 B
PHP
35 lines
933 B
PHP
<?php
|
|
|
|
namespace App\States\QrCode;
|
|
|
|
use Spatie\ModelStates\State;
|
|
use Spatie\ModelStates\StateConfig;
|
|
|
|
abstract class QrCodeState extends State
|
|
{
|
|
public const UNASSIGNED = 'unassigned';
|
|
|
|
public const ALLOCATED = 'allocated';
|
|
|
|
public const ACTIVE = 'active';
|
|
|
|
public const USED = 'used';
|
|
|
|
public const EXPIRED = 'expired';
|
|
|
|
public const VOIDED = 'voided';
|
|
|
|
public static function config(): StateConfig
|
|
{
|
|
return parent::config()
|
|
->default(Unassigned::class)
|
|
->allowTransition(Unassigned::class, Allocated::class)
|
|
->allowTransition(Allocated::class, Active::class)
|
|
->allowTransition(Active::class, Used::class)
|
|
->allowTransition([Allocated::class, Active::class], Expired::class)
|
|
->allowTransition([Unassigned::class, Allocated::class, Active::class], Voided::class);
|
|
}
|
|
|
|
abstract public function label(): string;
|
|
}
|