Laravel Slug pour les mots non anglais aussi

// Slugs for non-english words too
Laravel str_slug method in order to work with non-english words too. For example chaning ñ to n and ç to c. I always use this method for this kind of conversion:

function slugify($string, $replace = '-')
{
    $removeasci = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
    $removecomas = str_replace('\'', '', $removeasci);
    $output = preg_replace('/[^a-zA-Z0-9]/', $replace, $removecomas);

    return strtolower($output);
}
Michael Ataklt