Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

890 B
Raw Blame
<?php

namespace HiEvents\Helper;

use Illuminate\Support\Str;

class IdHelper
{
    public const ATTENDEE_PREFIX = 'a';

    public const ORDER_PREFIX = 'o';

    public const EVENT_PREFIX = 'e';

    public const ACCOUNT_PREFIX = 'acc';

    public const CHECK_IN_LIST_PREFIX = 'cil';

    public const CHECK_IN_PREFIX = 'ci';

    public const BOX_OFFICE_PREFIX = 'bo';

    public const OCCURRENCE_PREFIX = 'oc';

    public const LOCATION_PREFIX = 'loc';

    public const EVENT_LOCATION_PREFIX = 'el';

    public const WIDGET_PREFIX = 'wgt';

    public static function shortId(string $prefix, int $length = 13): string
    {
        return sprintf('%s_%s', $prefix, Str::random($length));
    }

    public static function publicId(string $prefix = '', string $suffix = '', int $length = 7): string
    {
        return Str::upper($prefix.'-'.Str::random($length).$suffix);
    }
}