Back to the Learning!

Laracasts is packed full with over 1,000 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Published On Sep. 6th 2017

Let's Build A Forum with Laravel and TDD: A Thread Should Have a Unique Slug: Part 2

Episode 76 Run Time 11:44

Download

At this point, we are generating slugs for each new thread; however, what happens if multiple threads have the same title? Everything will blow up, that's what! It sounds like we need to detect existing slugs in the database, and apply an increment to the slug.

View the source code for this episode on GitHub.