Adding clean URLS for the users profile page
There is nothing like sending a user to
profile/44444-55555-6666-7777 or any page in our application. In this recipe, I will add some slugs to the user profile page.
Slug? Semantic URL
Semantic URLs, also sometimes referred to as clean URLs, RESTful URLs, user-friendly URLs, or search engine-friendly URLs…
Refer to Wikipedia for more information: https://en.wikipedia.org/wiki/Semantic_URL and see an example slug in that URL.
A fresh install of Laravel can work for you with a database for making users for whom you can add a Slug.
How to do it…
- Install the needed library from https://packagist.org/packages/spatie/laravel-sluggable:
>composer require spatie/laravel-sluggable
- Update the database ...
Get Laravel 5.x Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.