Skip to content

customizeSlugEngine

Shipu Ahamed edited this page Sep 3, 2016 · 1 revision

customizeSlugEngine

/**
 * @param \Cocur\Slugify\Slugify $engine
 * @param string $attribute
 * @return \Cocur\Slugify\Slugify
 */
public function customizeSlugEngine(Slugify $engine, $attribute)
{
    ...
}

If this method exists on your model, the Slugify engine can be customized before slugging occurs. This might be where you change the character mappings that are used, or alter language files, etc..

You can customize the engine on a per-model and per-attribute basis (maybe your model has two slug fields, and one of them needs customization).

Take a look at tests/Models/PostWithCustomEngine.php for an example.

Clone this wiki locally