Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] add dictionary to slug helper #44730

Merged
merged 4 commits into from Oct 25, 2022

Conversation

imdhemy
Copy link
Contributor

@imdhemy imdhemy commented Oct 25, 2022

The current implementation of the Str::slug() method already replaces the @ with at. The keyboard still has some other replaceable characters.

E.g 500$ bill becomes 500-dollar-bill instead of 500-bill.

Besides, some languages have different rules for the replacement of special characters.
With the current implementation, we can have something like:

أحمد-at-المدرسة

which should be:

أحمد-في-المدرسة

This PR adds a new parameter to the Str::slug() method to allow the developer to specify the replacement character for the special characters.

It does not break the current implementation, as the default value for the new parameter is ['@' => 'at'].

imdhemy and others added 3 commits Oct 25, 2022
- allows custom replacements like `@` => `at`, `$` => `dollar`
@taylorotwell taylorotwell merged commit 9d4a5b3 into laravel:9.x Oct 25, 2022
20 checks passed
@driesvints
Copy link
Member

driesvints commented Oct 26, 2022

@milwad-dev please only comment when you have something to contribute to the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants