private function generate()
    {
        $characters = config('promocodes.characters');
        $mask = config('promocodes.mask');
        $promocode = '';
        $random = [];

        for ($i = 1; $i <= $this->length; $i++) {
            $character = $characters[rand(0, strlen($characters) - 1)];
            $random[] = $character;
        }

        shuffle($random);
        $length = count($random);

        $promocode .= $this->getPrefix();

        for ($i = 0; $i < $length; $i++) {
            $mask = preg_replace('/\*/', $random[$i], $mask, 1);
        }

        $promocode .= $mask;
        $promocode .= $this->getSuffix();

        return $promocode;
    }
private function generate()
    {
        $characters = config('promocodes.characters');
        $mask = config('promocodes.mask');
        $promocode = '';
        $random = [];

        for ($i = 1; $i <= $this->length; $i++) {
            $character = $characters[rand(0, strlen($characters) - 1)];
            $random[] = $character;
        }

        shuffle($random);
        $length = count($random);

        $promocode .= $this->getPrefix();

        for ($i = 0; $i < $length; $i++) {
            $mask = preg_replace('/\*/', $random[$i], $mask, 1);
        }

        $promocode .= $mask;
        $promocode .= $this->getSuffix();

        return $promocode;
    }
private function generate ( ) { $ characters = config ( 'promocodes.characters' ) ; $ mask = config ( 'promocodes.mask' ) ; $ promocode = '' ; $ random = [ ] ; for ( $ i = 1 ; $ i <= $ this -> length ; $ i ++ ) { $ character = $ characters [ rand ( 0 , strlen ( $ characters ) - 1 ) ] ; $ random [ ] = $ character ; } shuffle ( $ random ) ; $ length = count ( $ random ) ; $ promocode .= $ this -> getPrefix ( ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ mask = preg_replace ( '/\*/' , $ random [ $ i ] , $ mask , 1 ) ; } $ promocode .= $ mask ; $ promocode .= $ this -> getSuffix ( ) ; return $ promocode ; }
Here will be generated single code using your parameters from config.

@return string
Here will be generated single code using your parameters from config .