Since you can't serialise methods it is recommended you don't define methods within your configuration files. This is because if you want to later pass configurations to your queued jobs, this will not work.
You can make a helper class under e.g. your app
directory:
class HelperClass
{
public static function sluggableCustomSlugMethod($string, $separator = '-')
{
$_transliteration = array(
'/?|?|?/' => 'ae',
'/?|?/' => 'oe',
'/ü/' => 'ue',
'/?/' => 'Ae',
'/ü/' => 'Ue',
'/?/' => 'Oe',
'/à|á|?|?|?|?|ā|?|?|ǎ/' => 'A',
'/à|á|a|?|?|?|ā|?|?|ǎ|a/' => 'a',
'/?|?|?|?|?/' => 'C',
'/?|?|?|?|?/' => 'c',
'/D|?|?/' => 'D',
'/e|?|?/' => 'd',
'/è|é|ê|?|ē|?|?|?|ě/' => 'E',
'/è|é|ê|?|ē|?|?|?|ě/' => 'e',
'/?|?|?|?/' => 'G',
'/?|?|?|?/' => 'g',
'/?|?/' => 'H',
'/?|?/' => 'h',
'/ì|í|?|?|?|ī|?|ǐ|?|?/' => 'I',
'/ì|í|?|?|?|ī|?|ǐ|?|?/' => 'i',
'/?/' => 'J',
'/?/' => 'j',
'/?/' => 'K',
'/?/' => 'k',
'/?|?|?|?|?/' => 'L',
'/?|?|?|?|?/' => 'l',
'/?|?|?|?/' => 'N',
'/?|ń|?|ň|?/' => 'n',
'/ò|ó|?|?|ō|?|ǒ|?|?|?|?/' => 'O',
'/ò|ó|?|?|ō|?|ǒ|?|?|?|?|o/' => 'o',
'/?|?|?/' => 'R',
'/?|?|?/' => 'r',
'/?|?|?|?|?/' => 'S',
'/?|?|?|?|?|?/' => 's',
'/?|?|?|?/' => 'T',
'/?|?|?|?/' => 't',
'/ù|ú|?|?|ū|?|?|?|?|?|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'U',
'/ù|ú|?|?|ū|?|?|?|?|?|ǔ|ǖ|ǘ|ǚ|ǜ/' => 'u',
'/Y|?|?/' => 'Y',
'/y|?|?/' => 'y',
'/?/' => 'W',
'/?/' => 'w',
'/?|?|?/' => 'Z',
'/?|?|?/' => 'z',
'/?|?/' => 'AE',
'/?/' => 'ss',
'/?/' => 'IJ',
'/?/' => 'ij',
'/?/' => 'OE',
'/?/' => 'f'
);
$quotedReplacement = preg_quote($separator, '/');
$merge = array(
'/[^sp{Zs}p{Ll}p{Lm}p{Lo}p{Lt}p{Lu}p{Nd}]/mu' => ' ',
'/[sp{Zs}]+/mu' => $separator,
sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
);
$map = $_transliteration + $merge;
unset($_transliteration);
return preg_replace(array_keys($map), array_values($map), $string);
}
}
Then add this in your config/sluggable:
'method' => [ AppHelperClass::class, 'sluggableCustomSlugMethod' ]
This should allow you to serialise the configuration when you need to.