/ app / Enums / StatusEnum.php
StatusEnum.php
 1  <?php
 2  
 3  namespace App\Enums;
 4  
 5  use Spatie\Enum\Enum;
 6  
 7  /**
 8   * @method static self pending()
 9   * @method static self inProcess()
10   * @method static self finished()
11   * @method static self waiting()
12   * @method static self notApplicable()
13   */
14  
15  
16  class StatusEnum extends Enum
17  {
18      protected static function values(): array
19      {
20          return [
21              'pending' => 1,
22              'inProcess' => 2,
23              'finished' => 3,
24              'waiting' => 4,
25              'notApplicable' => 5
26          ];
27      }
28  
29      public static function lang(string $string): array
30      {
31          return [
32              [
33                  'name' => __($string . '.status.' . config('template.TEMPLATE_ROUTE') . '.pending'),
34                  'id' => self::pending()->value
35              ],
36              [
37                  'name' => __($string . '.status.' . config('template.TEMPLATE_ROUTE') . '.inProcess'),
38                  'id' =>  self::inProcess()->value
39              ],
40              [
41                  'name' => __($string . '.status.' . config('template.TEMPLATE_ROUTE') . '.finished'),
42                  'id' => self::finished()->value
43              ],
44              [
45                  'name' => __($string . '.status.' . config('template.TEMPLATE_ROUTE') . '.waiting'),
46                  'id' => self::waiting()->value
47              ],
48              [
49                  'name' => __($string . '.status.' . config('template.TEMPLATE_ROUTE') . '.notApplicable'),
50                  'id' => self::notApplicable()->value
51              ],
52          ];
53      }
54  }