[ 1 => ['constant' => 'TYPE_SUCCESS', 'label' => 'Success'], 2 => ['constant' => 'TYPE_ERROR', 'label' => 'Error'], 3 => ['constant' => 'TYPE_INFO', 'label' => 'Info'], 4 => ['constant' => 'TYPE_WARNING', 'label' => 'Warning'], ], ]; public static $rel = []; protected $table = '_flash_alerts'; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * Get the type as a string for client consumption * * @return string 'success'|'error'|'info'|'warning' */ public function get_type_string(): string { $type_map = [ self::TYPE_SUCCESS => 'success', self::TYPE_ERROR => 'error', self::TYPE_INFO => 'info', self::TYPE_WARNING => 'warning', ]; return $type_map[$this->type_id] ?? 'info'; } }