Dynamic URL in the Laravel

Asked

Viewed 286 times

0

I’m working on a website project for writers. In this project there are 12 genres within the table "categories", for example: Poems, Acrostics, Chronicles, etc.

I’m having trouble creating the routes to the genres correctly. Let’s suppose a user publishes a text of the genus Acrostics with title: Field Flowers.

The URL is being generated as follows: site.com/Acrostic/field flowers/

But I don’t want the categories to come with more letters and accents in the url, outside other parts of the site. So what’s the best way to solve this situation ?

Create 12 routes for each category and only pull the title Slug dynamically ? or remove the accents and letters more when generating the URL ?

2 answers

1

  • i decided on another way. I created a Slug column for the categories

0

I think the ideal is for you to work with slug, that one library can help a lot with this, it generates slugsfrom any field you set up and she still makes the treatment for the slugbe unique.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.