Description
AoA, I am Neubie on Laravel. Please help with how to generate SEO-Friendly URL Slug Automatically using Ajax.
W.salam, yes dear you can generate slug using Str::slug facade.
For example, you have a title variable and you want to generate a slug from it.
~~~
$title = 'Career Development Lab';
$slug = \Str::slug($title);
// output
Career-Development-Lab
~~~
For more unique slugs you can add the rand function with the slug or you can use library sluggableto generate a unique slug. For more information visit the below link to read the full article.
For Ajax calls you can send ajax call to server to generate a slug. Follow below article.
Generate slug in Laravel using ajax call
1 Like 0 Comments