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

[5.4] Add kebab case to Str with kebab_case helper #18084

Merged
merged 1 commit into from Feb 24, 2017

Conversation

calebporzio
Copy link
Contributor

@calebporzio calebporzio commented Feb 23, 2017

It seems to be a convention to "kebab-case" blade view names. Therefore, a kebab method would be helpful for instances such as the following:

I want to "polymorphically" change views based on different notification types.

<a href="#">
    @include('notifications.' . snake_case(class_basename($notification->type), '-'))
</a>

Could become:

<a href="#">
    @include('notifications.' . kebab_case(class_basename($notification->type)))
</a>

Thanks for the hard work and time put into reviewing PRs like these.

@themsaid themsaid changed the title Add kebab case to Str with kebab_case helper [5.4] Add kebab case to Str with kebab_case helper Feb 23, 2017
@taylorotwell taylorotwell merged commit b8eec63 into laravel:5.4 Feb 24, 2017
@bbashy
Copy link
Contributor

bbashy commented Mar 3, 2017

Can't you just use str_slug()?

@calebporzio
Copy link
Contributor Author

Cool, didn't know that. Maybe that's reason in itself it needs to be in there...?

@bbashy
Copy link
Contributor

bbashy commented Mar 3, 2017

It's fine having a separate helper but assumed you knew about str_slug() 😄

@vpratfr
Copy link
Contributor

vpratfr commented Mar 7, 2017

@calebporzio You should update the docs too, that helper function is not referenced in the corresponding chapter.

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

4 participants